From 891f0ccd18b3b86f7ebcc6677aaf0e66f019e316 Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Tue, 7 Mar 2017 14:44:34 +0000 Subject: [PATCH] include selected sidebar tab in url query params --- app/app/components/document/sidebar-zone.js | 8 ++++---- app/app/pods/document/index/route.js | 4 ++++ app/app/pods/document/index/template.hbs | 2 +- app/app/templates/components/document/sidebar-zone.hbs | 10 +++++----- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/app/components/document/sidebar-zone.js b/app/app/components/document/sidebar-zone.js index 125c6a32..52c07f44 100644 --- a/app/app/components/document/sidebar-zone.js +++ b/app/app/components/document/sidebar-zone.js @@ -30,13 +30,13 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, { name: "", description: "" }, - currentTab: '', + tab: '', init() { this._super(...arguments); - if (is.empty(this.get('currentTab'))) { - this.set('currentTab', 'attachments'); + if (is.empty(this.get('tab'))) { + this.set('tab', 'attachments'); } }, @@ -65,7 +65,7 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, { actions: { onChangeTab(tab) { - this.set('currentTab', tab); + this.set('tab', tab); }, onTagChange(tags) { diff --git a/app/app/pods/document/index/route.js b/app/app/pods/document/index/route.js index 93757b0d..55415078 100644 --- a/app/app/pods/document/index/route.js +++ b/app/app/pods/document/index/route.js @@ -20,11 +20,15 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { queryParams: { pageId: { refreshModel: true + }, + tab: { + refreshModel: false } }, beforeModel(transition) { this.set('pageId', is.not.undefined(transition.queryParams.pageId) ? transition.queryParams.pageId : ''); + this.set('tab', is.not.undefined(transition.queryParams.tab) ? transition.queryParams.tab : ''); }, model() { diff --git a/app/app/pods/document/index/template.hbs b/app/app/pods/document/index/template.hbs index 30ad690f..ab09ced5 100644 --- a/app/app/pods/document/index/template.hbs +++ b/app/app/pods/document/index/template.hbs @@ -2,7 +2,7 @@ diff --git a/app/app/templates/components/document/sidebar-zone.hbs b/app/app/templates/components/document/sidebar-zone.hbs index 46f220fe..431b6f59 100644 --- a/app/app/templates/components/document/sidebar-zone.hbs +++ b/app/app/templates/components/document/sidebar-zone.hbs @@ -3,15 +3,15 @@ more_horiz
-
+
view_headline
-
+
attach_file
-
+
timeline
@@ -36,11 +36,11 @@
- {{#if (is-equal currentTab 'attachments')}} + {{#if (is-equal tab 'attachments')}} {{document/sidebar-view-attachments document=document isEditor=isEditor}} {{/if}} - {{#if (is-equal currentTab 'activity')}} + {{#if (is-equal tab 'activity')}} {{document/sidebar-view-activity document=document pages=pages isEditor=isEditor}} {{/if}}