|
@@ -1,3 +1,12 @@
|
|
|
+// XXX This event list must be abstracted somewhere else.
|
|
|
+var endTransitionEvents = [
|
|
|
+ 'webkitTransitionEnd',
|
|
|
+ 'otransitionend',
|
|
|
+ 'oTransitionEnd',
|
|
|
+ 'msTransitionEnd',
|
|
|
+ 'transitionend'
|
|
|
+].join(' ');
|
|
|
+
|
|
|
BlazeComponent.extendComponent({
|
|
|
template: function() {
|
|
|
return 'boardComponent';
|
|
@@ -17,50 +26,78 @@ BlazeComponent.extendComponent({
|
|
|
// TODO
|
|
|
},
|
|
|
|
|
|
+ currentCardIsInThisList: function() {
|
|
|
+ var currentCard = Cards.findOne(Session.get('currentCard'));
|
|
|
+ var listId = this.currentData()._id;
|
|
|
+ return currentCard && currentCard.listId === listId;
|
|
|
+ },
|
|
|
+
|
|
|
onRendered: function() {
|
|
|
var self = this;
|
|
|
|
|
|
self.scrollLeft();
|
|
|
|
|
|
- if (Meteor.user().isBoardMember()) {
|
|
|
- self.$('.js-lists').sortable({
|
|
|
- tolerance: 'pointer',
|
|
|
- appendTo: '.js-lists',
|
|
|
- helper: 'clone',
|
|
|
- items: '.js-list:not(.add-list)',
|
|
|
- placeholder: 'list placeholder',
|
|
|
- start: function(event, ui) {
|
|
|
- $('.list.placeholder').height(ui.item.height());
|
|
|
- Popup.close();
|
|
|
- },
|
|
|
- stop: function() {
|
|
|
- self.$('.js-lists').find('.js-list:not(.add-list)').each(
|
|
|
- function(i, list) {
|
|
|
- var data = Blaze.getData(list);
|
|
|
- Lists.update(data._id, {
|
|
|
- $set: {
|
|
|
- sort: i
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- );
|
|
|
+ var lists = this.find('.js-lists');
|
|
|
+
|
|
|
+ // We want to animate the card details window closing. We rely on CSS
|
|
|
+ // transition for the actual animation.
|
|
|
+ lists._uihooks = {
|
|
|
+ removeElement: function(node) {
|
|
|
+ var removeNode = function() {
|
|
|
+ node.parentNode.removeChild(node);
|
|
|
+ };
|
|
|
+ if ($(node).hasClass('js-card-detail')) {
|
|
|
+ $(node).css({
|
|
|
+ flex: '0',
|
|
|
+ padding: 0
|
|
|
+ });
|
|
|
+ $(lists).one(endTransitionEvents, function() {
|
|
|
+ removeNode();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ removeNode();
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ if (! Meteor.user().isBoardMember())
|
|
|
+ return;
|
|
|
|
|
|
- // If there is no data in the board (ie, no lists) we autofocus the list
|
|
|
- // creation form by clicking on the corresponding element.
|
|
|
- if (self.data().lists().count() === 0) {
|
|
|
- this.openNewListForm();
|
|
|
+ self.$(lists).sortable({
|
|
|
+ tolerance: 'pointer',
|
|
|
+ appendTo: '.js-lists',
|
|
|
+ helper: 'clone',
|
|
|
+ items: '.js-list:not(.add-list)',
|
|
|
+ placeholder: 'list placeholder',
|
|
|
+ start: function(event, ui) {
|
|
|
+ $('.list.placeholder').height(ui.item.height());
|
|
|
+ Popup.close();
|
|
|
+ },
|
|
|
+ stop: function() {
|
|
|
+ self.$('.js-lists').find('.js-list:not(.add-list)').each(
|
|
|
+ function(i, list) {
|
|
|
+ var data = Blaze.getData(list);
|
|
|
+ Lists.update(data._id, {
|
|
|
+ $set: {
|
|
|
+ sort: i
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ );
|
|
|
}
|
|
|
+ });
|
|
|
+
|
|
|
+ // If there is no data in the board (ie, no lists) we autofocus the list
|
|
|
+ // creation form by clicking on the corresponding element.
|
|
|
+ if (self.data().lists().count() === 0) {
|
|
|
+ this.openNewListForm();
|
|
|
}
|
|
|
},
|
|
|
|
|
|
sidebarSize: function() {
|
|
|
var sidebar = this.componentChildren('boardSidebar')[0];
|
|
|
- if (Session.get('currentCard') !== null)
|
|
|
- return 'next-large-sidebar';
|
|
|
- else if (sidebar && sidebar.isOpen())
|
|
|
- return 'next-small-sidebar';
|
|
|
+ if (sidebar && sidebar.isOpen())
|
|
|
+ return 'next-sidebar';
|
|
|
}
|
|
|
}).register('boardComponent');
|
|
|
|