diff options
Diffstat (limited to 'client/components/lists')
-rw-r--r-- | client/components/lists/list.js | 25 | ||||
-rw-r--r-- | client/components/lists/listBody.js | 25 | ||||
-rw-r--r-- | client/components/lists/listHeader.js | 16 |
3 files changed, 37 insertions, 29 deletions
diff --git a/client/components/lists/list.js b/client/components/lists/list.js index 6bd8eefe..8433ad90 100644 --- a/client/components/lists/list.js +++ b/client/components/lists/list.js @@ -73,16 +73,15 @@ BlazeComponent.extendComponent({ const listId = Blaze.getData(ui.item.parents('.list').get(0))._id; const currentBoard = Boards.findOne(Session.get('currentBoard')); let swimlaneId = ''; - const boardView = (Meteor.user().profile || {}).boardView; if ( - boardView === 'board-view-swimlanes' || + Utils.boardView() === 'board-view-swimlanes' || currentBoard.isTemplatesBoard() ) swimlaneId = Blaze.getData(ui.item.parents('.swimlane').get(0))._id; else if ( - boardView === 'board-view-lists' || - boardView === 'board-view-cal' || - !boardView + Utils.boardView() === 'board-view-lists' || + Utils.boardView() === 'board-view-cal' || + !Utils.boardView ) swimlaneId = currentBoard.getDefaultSwimline()._id; @@ -116,11 +115,11 @@ BlazeComponent.extendComponent({ // ugly touch event hotfix enableClickOnTouch(itemsSelector); + import { Cookies } from 'meteor/ostrio:cookies'; + const cookies = new Cookies(); + this.autorun(() => { - if ( - Utils.isMiniScreen() || - (!Utils.isMiniScreen() && Meteor.user().hasShowDesktopDragHandles()) - ) { + if (!Utils.isMiniScreen() && cookies.has('showDesktopDragHandles')) { $cards.sortable({ handle: '.handle', }); @@ -164,7 +163,13 @@ BlazeComponent.extendComponent({ Template.list.helpers({ showDesktopDragHandles() { - return Meteor.user().hasShowDesktopDragHandles(); + import { Cookies } from 'meteor/ostrio:cookies'; + const cookies = new Cookies(); + if (cookies.has('showDesktopDragHandles')) { + return true; + } else { + return false; + } }, }); diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index c8e41a0b..46d2794e 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -48,7 +48,6 @@ BlazeComponent.extendComponent({ const board = this.data().board(); let linkedId = ''; let swimlaneId = ''; - const boardView = (Meteor.user().profile || {}).boardView; let cardType = 'cardType-card'; if (title) { if (board.isTemplatesBoard()) { @@ -71,14 +70,14 @@ BlazeComponent.extendComponent({ }); cardType = 'cardType-linkedBoard'; } - } else if (boardView === 'board-view-swimlanes') + } else if (Utils.boardView() === 'board-view-swimlanes') swimlaneId = this.parentComponent() .parentComponent() .data()._id; else if ( - boardView === 'board-view-lists' || - boardView === 'board-view-cal' || - !boardView + Utils.boardView() === 'board-view-lists' || + Utils.boardView() === 'board-view-cal' || + !Utils.boardView ) swimlaneId = board.getDefaultSwimline()._id; @@ -157,9 +156,8 @@ BlazeComponent.extendComponent({ }, idOrNull(swimlaneId) { - const currentUser = Meteor.user(); if ( - (currentUser.profile || {}).boardView === 'board-view-swimlanes' || + Utils.boardView() === 'board-view-swimlanes' || this.data() .board() .isTemplatesBoard() @@ -397,10 +395,9 @@ BlazeComponent.extendComponent({ '.js-swimlane', ); this.swimlaneId = ''; - const boardView = (Meteor.user().profile || {}).boardView; - if (boardView === 'board-view-swimlanes') + if (Utils.boardView() === 'board-view-swimlanes') this.swimlaneId = Blaze.getData(swimlane[0])._id; - else if (boardView === 'board-view-lists' || !boardView) + else if (Utils.boardView() === 'board-view-lists' || !Utils.boardView) this.swimlaneId = Swimlanes.findOne({ boardId: this.boardId })._id; }, @@ -580,7 +577,7 @@ BlazeComponent.extendComponent({ const swimlane = $(Popup._getTopStack().openerElement).parents( '.js-swimlane', ); - if ((Meteor.user().profile || {}).boardView === 'board-view-swimlanes') + if (Utils.boardView() === 'board-view-swimlanes') this.swimlaneId = Blaze.getData(swimlane[0])._id; else this.swimlaneId = Swimlanes.findOne({ boardId: this.boardId })._id; // List where to insert card @@ -709,8 +706,7 @@ BlazeComponent.extendComponent({ if (isSandstorm) { const user = Meteor.user(); if (user) { - const boardView = (Meteor.user().profile || {}).boardView; - if (boardView === 'board-view-swimlanes') { + if (Utils.boardView() === 'board-view-swimlanes') { this.swimlaneId = this.parentComponent() .parentComponent() .parentComponent() @@ -718,8 +714,7 @@ BlazeComponent.extendComponent({ } } } else { - const boardView = (Meteor.user().profile || {}).boardView; - if (boardView === 'board-view-swimlanes') { + if (Utils.boardView() === 'board-view-swimlanes') { this.swimlaneId = this.parentComponent() .parentComponent() .parentComponent() diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js index b524d4e0..90946610 100644 --- a/client/components/lists/listHeader.js +++ b/client/components/lists/listHeader.js @@ -44,14 +44,16 @@ BlazeComponent.extendComponent({ }, limitToShowCardsCount() { - return Meteor.user().getLimitToShowCardsCount(); + const currentUser = Meteor.user(); + if (currentUser) { + return Meteor.user().getLimitToShowCardsCount(); + } }, cardsCount() { const list = Template.currentData(); let swimlaneId = ''; - const boardView = (Meteor.user().profile || {}).boardView; - if (boardView === 'board-view-swimlanes') + if (Utils.boardView() === 'board-view-swimlanes') swimlaneId = this.parentComponent() .parentComponent() .data()._id; @@ -100,7 +102,13 @@ BlazeComponent.extendComponent({ Template.listHeader.helpers({ showDesktopDragHandles() { - return Meteor.user().hasShowDesktopDragHandles(); + import { Cookies } from 'meteor/ostrio:cookies'; + const cookies = new Cookies(); + if (cookies.has('showDesktopDragHandles')) { + return true; + } else { + return false; + } }, }); |