Merge branch 'fixDragInListsView' of https://github.com/andresmanelli/wekan into andresmanelli-fixDragInListsView

This commit is contained in:
Lauri Ojansivu 2018-03-31 19:38:33 +03:00
commit 4505495762
3 changed files with 99 additions and 88 deletions

View file

@ -1,13 +0,0 @@
BlazeComponent.extendComponent({
currentCardIsInThisList(listId, swimlaneId) {
const currentCard = Cards.findOne(Session.get('currentCard'));
const currentBoardId = Session.get('currentBoard');
const board = Boards.findOne(currentBoardId);
if (board.view === 'board-view-lists')
return currentCard && currentCard.listId === listId;
else if (board.view === 'board-view-swimlanes')
return currentCard && currentCard.listId === listId && currentCard.swimlaneId === swimlaneId;
else
return false;
},
}).register('listsGroup');

View file

@ -1,14 +1,18 @@
const { calculateIndex } = Utils; const { calculateIndex } = Utils;
BlazeComponent.extendComponent({ function currentCardIsInThisList(listId, swimlaneId) {
onRendered() { const currentCard = Cards.findOne(Session.get('currentCard'));
const boardComponent = this.parentComponent(); const currentBoardId = Session.get('currentBoard');
const $listsDom = this.$('.js-lists'); const board = Boards.findOne(currentBoardId);
if (board.view === 'board-view-lists')
if (!Session.get('currentCard')) { return currentCard && currentCard.listId === listId;
boardComponent.scrollLeft(); else if (board.view === 'board-view-swimlanes')
} return currentCard && currentCard.listId === listId && currentCard.swimlaneId === swimlaneId;
else
return false;
};
function initSortable(boardComponent, $listsDom) {
// We want to animate the card details window closing. We rely on CSS // We want to animate the card details window closing. We rely on CSS
// transition for the actual animation. // transition for the actual animation.
$listsDom._uihooks = { $listsDom._uihooks = {
@ -74,6 +78,18 @@ BlazeComponent.extendComponent({
MultiSelection.isActive() || !userIsMember()); MultiSelection.isActive() || !userIsMember());
} }
}); });
};
BlazeComponent.extendComponent({
onRendered() {
const boardComponent = this.parentComponent();
const $listsDom = this.$('.js-lists');
if (!Session.get('currentCard')) {
boardComponent.scrollLeft();
}
initSortable(boardComponent, $listsDom);
}, },
onCreated() { onCreated() {
this.draggingActive = new ReactiveVar(false); this.draggingActive = new ReactiveVar(false);
@ -87,15 +103,7 @@ BlazeComponent.extendComponent({
}, },
currentCardIsInThisList(listId, swimlaneId) { currentCardIsInThisList(listId, swimlaneId) {
const currentCard = Cards.findOne(Session.get('currentCard')); return currentCardIsInThisList(listId, swimlaneId);
const currentBoardId = Session.get('currentBoard');
const board = Boards.findOne(currentBoardId);
if (board.view === 'board-view-lists')
return currentCard && currentCard.listId === listId;
else if (board.view === 'board-view-swimlanes')
return currentCard && currentCard.listId === listId && currentCard.swimlaneId === swimlaneId;
else
return false;
}, },
events() { events() {
@ -210,3 +218,19 @@ Template.swimlane.helpers({
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly(); return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
}, },
}); });
BlazeComponent.extendComponent({
currentCardIsInThisList(listId, swimlaneId) {
return currentCardIsInThisList(listId, swimlaneId);
},
onRendered() {
const boardComponent = this.parentComponent();
const $listsDom = this.$('.js-lists');
if (!Session.get('currentCard')) {
boardComponent.scrollLeft();
}
initSortable(boardComponent, $listsDom);
},
}).register('listsGroup');

View file

@ -39,7 +39,7 @@
margin-top: 50px; margin-top: 50px;
font-weight: bold; font-weight: bold;
min-height: 9px; min-height: 9px;
min-width: 30px; width: 50px;
overflow: hidden; overflow: hidden;
-o-text-overflow: ellipsis; -o-text-overflow: ellipsis;
text-overflow: ellipsis; text-overflow: ellipsis;