diff options
Diffstat (limited to 'client/components/sidebar')
-rw-r--r-- | client/components/sidebar/sidebar.jade | 6 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.js | 29 |
2 files changed, 29 insertions, 6 deletions
diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade index 07cd777c..07d6bbcf 100644 --- a/client/components/sidebar/sidebar.jade +++ b/client/components/sidebar/sidebar.jade @@ -4,11 +4,7 @@ template(name="sidebar") class="{{#if isTongueHidden}}is-hidden{{/if}}") i.fa.fa-chevron-left .sidebar-content.js-board-sidebar-content.js-perfect-scrollbar - //- XXX https://github.com/peerlibrary/meteor-blaze-components/issues/30 - if Filter.isActive - +filterSidebar - else - +homeSidebar + +Template.dynamic(template=getViewTemplate) template(name='homeSidebar') +membersWidget diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index 6e45b5cf..729bc42b 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -1,3 +1,7 @@ +var defaultView = 'home'; + +Sidebar = null; + BlazeComponent.extendComponent({ template: function() { return 'sidebar'; @@ -9,9 +13,14 @@ BlazeComponent.extendComponent({ onCreated: function() { this._isOpen = new ReactiveVar(! Session.get('currentCard')); + this._view = new ReactiveVar(defaultView); Sidebar = this; }, + onDestroyed: function() { + Sidebar = null; + }, + isOpen: function() { return this._isOpen.get(); }, @@ -43,7 +52,20 @@ BlazeComponent.extendComponent({ }, isTongueHidden: function() { - return this.isOpen() && Filter.isActive(); + return this.isOpen() && this.getView() !== defaultView; + }, + + getView: function() { + return this._view.get(); + }, + + setView: function(view) { + view = view || defaultView; + this._view.set(view); + }, + + getViewTemplate: function() { + return this.getView() + 'Sidebar'; }, onRendered: function() { @@ -74,3 +96,8 @@ BlazeComponent.extendComponent({ }]); } }).register('sidebar'); + +EscapeActions.register(40, + function() { return Sidebar && Sidebar.getView() !== defaultView; }, + function() { Sidebar.setView(defaultView); } +); |