diff options
Diffstat (limited to 'client/components/swimlanes')
-rw-r--r-- | client/components/swimlanes/swimlaneHeader.js | 4 | ||||
-rw-r--r-- | client/components/swimlanes/swimlanes.jade | 22 | ||||
-rw-r--r-- | client/components/swimlanes/swimlanes.js | 68 |
3 files changed, 24 insertions, 70 deletions
diff --git a/client/components/swimlanes/swimlaneHeader.js b/client/components/swimlanes/swimlaneHeader.js index 69971b05..fbc45351 100644 --- a/client/components/swimlanes/swimlaneHeader.js +++ b/client/components/swimlanes/swimlaneHeader.js @@ -1,3 +1,5 @@ +import { Cookies } from 'meteor/ostrio:cookies'; +const cookies = new Cookies(); const { calculateIndexData } = Utils; let swimlaneColors; @@ -34,8 +36,6 @@ Template.swimlaneHeader.helpers({ if (currentUser) { return (currentUser.profile || {}).showDesktopDragHandles; } else { - import { Cookies } from 'meteor/ostrio:cookies'; - const cookies = new Cookies(); if (cookies.has('showDesktopDragHandles')) { return true; } else { diff --git a/client/components/swimlanes/swimlanes.jade b/client/components/swimlanes/swimlanes.jade index b2e03afe..1dc23c59 100644 --- a/client/components/swimlanes/swimlanes.jade +++ b/client/components/swimlanes/swimlanes.jade @@ -20,28 +20,6 @@ template(name="swimlane") if currentUser.isBoardMember unless currentUser.isCommentOnly +addListForm - //if collapseSwimlane - // // Minimize swimlanes next 2 lines below https://www.w3schools.com/howto/howto_js_accordion.asp - // button(class="accordion") - // div(class="panel") - // .swimlane.js-lists.js-swimlane - // if isMiniScreen - // if currentListIsInThisSwimlane _id - // +list(currentList) - // unless currentList - // each lists - // +miniList(this) - // if currentUser.isBoardMember - // unless currentUser.isCommentOnly - // +addListForm - // else - // each lists - // +list(this) - // if currentCardIsInThisList _id ../_id - // +cardDetails(currentCard) - // if currentUser.isBoardMember - // unless currentUser.isCommentOnly - // +addListForm template(name="listsGroup") .swimlane.list-group.js-lists diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js index 9bc093be..d072a2a2 100644 --- a/client/components/swimlanes/swimlanes.js +++ b/client/components/swimlanes/swimlanes.js @@ -1,10 +1,12 @@ +import { Cookies } from 'meteor/ostrio:cookies'; +const cookies = new Cookies(); const { calculateIndex, enableClickOnTouch } = Utils; function currentListIsInThisSwimlane(swimlaneId) { const currentList = Lists.findOne(Session.get('currentList')); return ( - currentList - && (currentList.swimlaneId === swimlaneId || currentList.swimlaneId === '') + currentList && + (currentList.swimlaneId === swimlaneId || currentList.swimlaneId === '') ); } @@ -12,14 +14,14 @@ function currentCardIsInThisList(listId, swimlaneId) { const currentCard = Cards.findOne(Session.get('currentCard')); const currentUser = Meteor.user(); if ( - currentUser - && currentUser.profile - && Utils.boardView() === 'board-view-swimlanes' + currentUser && + currentUser.profile && + Utils.boardView() === 'board-view-swimlanes' ) return ( - currentCard - && currentCard.listId === listId - && currentCard.swimlaneId === swimlaneId + currentCard && + currentCard.listId === listId && + currentCard.swimlaneId === swimlaneId ); // Default view: board-view-lists else return currentCard && currentCard.listId === listId; @@ -90,9 +92,9 @@ function initSortable(boardComponent, $listsDom) { function userIsMember() { return ( - Meteor.user() - && Meteor.user().isBoardMember() - && !Meteor.user().isCommentOnly() + Meteor.user() && + Meteor.user().isBoardMember() && + !Meteor.user().isCommentOnly() ); } @@ -103,8 +105,6 @@ function initSortable(boardComponent, $listsDom) { showDesktopDragHandles = (currentUser.profile || {}) .showDesktopDragHandles; } else { - import { Cookies } from 'meteor/ostrio:cookies'; - const cookies = new Cookies(); if (cookies.has('showDesktopDragHandles')) { showDesktopDragHandles = true; } else { @@ -146,26 +146,6 @@ BlazeComponent.extendComponent({ } initSortable(boardComponent, $listsDom); - - import { Cookies } from 'meteor/ostrio:cookies'; - const cookies = new Cookies(); - if (cookies.has('collapseSwimlane')) { - // Minimize swimlanes start https://www.w3schools.com/howto/howto_js_accordion.asp - const acc = document.getElementsByClassName('accordion'); - let i; - for (i = 0; i < acc.length; i++) { - acc[i].addEventListener('click', function() { - this.classList.toggle('active'); - const panel = this.nextElementSibling; - if (panel.style.maxHeight) { - panel.style.maxHeight = null; - } else { - panel.style.maxHeight = `${panel.scrollHeight}px`; - } - }); - } - // Minimize swimlanes end https://www.w3schools.com/howto/howto_js_accordion.asp - } }, onCreated() { this.draggingActive = new ReactiveVar(false); @@ -203,8 +183,6 @@ BlazeComponent.extendComponent({ showDesktopDragHandles = (currentUser.profile || {}) .showDesktopDragHandles; } else { - import { Cookies } from 'meteor/ostrio:cookies'; - const cookies = new Cookies(); if (cookies.has('showDesktopDragHandles')) { showDesktopDragHandles = true; } else { @@ -213,15 +191,15 @@ BlazeComponent.extendComponent({ } const noDragInside = ['a', 'input', 'textarea', 'p'].concat( - Utils.isMiniScreen() - || (!Utils.isMiniScreen() && showDesktopDragHandles) + Utils.isMiniScreen() || + (!Utils.isMiniScreen() && showDesktopDragHandles) ? ['.js-list-handle', '.js-swimlane-header-handle'] : ['.js-list-header'], ); if ( - $(evt.target).closest(noDragInside.join(',')).length === 0 - && this.$('.swimlane').prop('clientHeight') > evt.offsetY + $(evt.target).closest(noDragInside.join(',')).length === 0 && + this.$('.swimlane').prop('clientHeight') > evt.offsetY ) { this._isDragging = true; this._lastDragPositionX = evt.clientX; @@ -255,8 +233,8 @@ BlazeComponent.extendComponent({ onCreated() { this.currentBoard = Boards.findOne(Session.get('currentBoard')); this.isListTemplatesSwimlane = - this.currentBoard.isTemplatesBoard() - && this.currentData().isListTemplatesSwimlane(); + this.currentBoard.isTemplatesBoard() && + this.currentData().isListTemplatesSwimlane(); this.currentSwimlane = this.currentData(); }, @@ -299,8 +277,6 @@ Template.swimlane.helpers({ if (currentUser) { return (currentUser.profile || {}).showDesktopDragHandles; } else { - import { Cookies } from 'meteor/ostrio:cookies'; - const cookies = new Cookies(); if (cookies.has('showDesktopDragHandles')) { return true; } else { @@ -310,9 +286,9 @@ Template.swimlane.helpers({ }, canSeeAddList() { return ( - Meteor.user() - && Meteor.user().isBoardMember() - && !Meteor.user().isCommentOnly() + Meteor.user() && + Meteor.user().isBoardMember() && + !Meteor.user().isCommentOnly() ); }, }); |