Implement multi-selection

The UI and the internal APIs are still rough around the edges but the
feature is basically working. You can now select multiple cards and
move them together or (un|)assign them a label.
This commit is contained in:
Maxime Quandalle 2015-05-29 23:35:30 +02:00
parent 6457615e6a
commit 2c0030da62
45 changed files with 883 additions and 933 deletions

View file

@ -1,6 +1,11 @@
Sidebar = null;
var defaultView = 'home';
Sidebar = null;
var viewTitles = {
filter: 'filter-cards',
multiselection: 'multi-selection'
};
BlazeComponent.extendComponent({
template: function() {
@ -60,14 +65,23 @@ BlazeComponent.extendComponent({
},
setView: function(view) {
view = view || defaultView;
view = _.isString(view) ? view : defaultView;
this._view.set(view);
this.open();
},
isDefaultView: function() {
return this.getView() === defaultView;
},
getViewTemplate: function() {
return this.getView() + 'Sidebar';
},
getViewTitle: function() {
return TAPi18n.__(viewTitles[this.getView()]);
},
// Board members can assign people or labels by drag-dropping elements from
// the sidebar to the cards on the board. In order to re-initialize the
// jquery-ui plugin any time a draggable member or label is modified or
@ -108,12 +122,13 @@ BlazeComponent.extendComponent({
// XXX Hacky, we need some kind of `super`
var mixinEvents = this.getMixin(Mixins.InfiniteScrolling).events();
return mixinEvents.concat([{
'click .js-toogle-sidebar': this.toogle
'click .js-toogle-sidebar': this.toogle,
'click .js-back-home': this.setView
}]);
}
}).register('sidebar');
EscapeActions.register('sidebarView',
function() { return Sidebar && Sidebar.getView() !== defaultView; },
function() { Sidebar.setView(defaultView); }
function() { Sidebar.setView(defaultView); },
function() { return Sidebar && Sidebar.getView() !== defaultView; }
);