mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Implement a new system to handle "escape actions"
The new EscapeActions object decide what to do when the user press the Escape key (such as closing a opened popup or inlined form). This commit also re-introduced the sidebar current view as a sidebar component local state.
This commit is contained in:
parent
1b4fcc67f4
commit
40c2411f2a
13 changed files with 148 additions and 53 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue