diff options
Diffstat (limited to 'client/components/lists')
-rw-r--r-- | client/components/lists/list.js | 29 | ||||
-rw-r--r-- | client/components/lists/list.styl | 6 | ||||
-rw-r--r-- | client/components/lists/listBody.js | 25 | ||||
-rw-r--r-- | client/components/lists/listHeader.jade | 50 | ||||
-rw-r--r-- | client/components/lists/listHeader.js | 15 |
5 files changed, 83 insertions, 42 deletions
diff --git a/client/components/lists/list.js b/client/components/lists/list.js index 89d51e85..839304f8 100644 --- a/client/components/lists/list.js +++ b/client/components/lists/list.js @@ -1,6 +1,6 @@ import { Cookies } from 'meteor/ostrio:cookies'; const cookies = new Cookies(); -const { calculateIndex, enableClickOnTouch } = Utils; +const { calculateIndex } = Utils; BlazeComponent.extendComponent({ // Proxy @@ -114,9 +114,6 @@ BlazeComponent.extendComponent({ }, }); - // ugly touch event hotfix - enableClickOnTouch(itemsSelector); - this.autorun(() => { let showDesktopDragHandles = false; currentUser = Meteor.user(); @@ -129,18 +126,26 @@ BlazeComponent.extendComponent({ showDesktopDragHandles = false; } - if (!Utils.isMiniScreen() && showDesktopDragHandles) { + if (Utils.isMiniScreen() || showDesktopDragHandles) { $cards.sortable({ handle: '.handle', }); - } else { + } else if (!Utils.isMiniScreen() && !showDesktopDragHandles) { $cards.sortable({ handle: '.minicard', }); } - // Disable drag-dropping if the current user is not a board member or is comment only - $cards.sortable('option', 'disabled', !userIsMember()); + if ($cards.data('uiSortable') || $cards.data('sortable')) { + $cards.sortable( + 'option', + 'disabled', + // Disable drag-dropping when user is not member + !userIsMember(), + // Not disable drag-dropping while in multi-selection mode + // MultiSelection.isActive() || !userIsMember(), + ); + } }); // We want to re-run this function any time a card is added. @@ -176,12 +181,10 @@ Template.list.helpers({ currentUser = Meteor.user(); if (currentUser) { return (currentUser.profile || {}).showDesktopDragHandles; + } else if (cookies.has('showDesktopDragHandles')) { + return true; } else { - if (cookies.has('showDesktopDragHandles')) { - return true; - } else { - return false; - } + return false; } }, }); diff --git a/client/components/lists/list.styl b/client/components/lists/list.styl index 27cf678c..bc7f763f 100644 --- a/client/components/lists/list.styl +++ b/client/components/lists/list.styl @@ -43,9 +43,6 @@ background: white margin: -3px 0 8px -.list-header-card-count - height: 35px - .list-header-add flex: 0 0 auto padding: 20px 12px 4px @@ -60,6 +57,9 @@ background-color: #e4e4e4; border-bottom: 6px solid #e4e4e4; + &.list-header-card-count + min-height: 35px + height: auto &.ui-sortable-handle cursor: grab diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index b0974705..88f88db0 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -189,7 +189,8 @@ BlazeComponent.extendComponent({ !this.reachedWipLimit() && Meteor.user() && Meteor.user().isBoardMember() && - !Meteor.user().isCommentOnly() + !Meteor.user().isCommentOnly() && + !Meteor.user().isWorker() ); }, @@ -410,7 +411,7 @@ BlazeComponent.extendComponent({ type: 'board', }, { - sort: ['title'], + sort: { sort: 1 /* boards default sorting */ }, }, ); return boards; @@ -596,7 +597,7 @@ BlazeComponent.extendComponent({ type: 'board', }, { - sort: ['title'], + sort: { sort: 1 /* boards default sorting */ }, }, ); return boards; @@ -742,9 +743,25 @@ BlazeComponent.extendComponent({ }, updateList() { + // Use fallback when requestIdleCallback is not available on iOS and Safari + // https://www.afasterweb.com/2017/11/20/utilizing-idle-moments/ + checkIdleTime = + window.requestIdleCallback || + function(handler) { + const startTime = Date.now(); + return setTimeout(function() { + handler({ + didTimeout: false, + timeRemaining() { + return Math.max(0, 50.0 - (Date.now() - startTime)); + }, + }); + }, 1); + }; + if (this.spinnerInView()) { this.cardlimit.set(this.cardlimit.get() + InfiniteScrollIter); - window.requestIdleCallback(() => this.updateList()); + checkIdleTime(() => this.updateList()); } }, diff --git a/client/components/lists/listHeader.jade b/client/components/lists/listHeader.jade index 631f68a0..fa1faf34 100644 --- a/client/components/lists/listHeader.jade +++ b/client/components/lists/listHeader.jade @@ -10,7 +10,7 @@ template(name="listHeader") a.list-header-left-icon.fa.fa-angle-left.js-unselect-list h2.list-header-name( title="{{ moment modifiedAt 'LLL' }}" - class="{{#if currentUser.isBoardMember}}{{#unless currentUser.isCommentOnly}}js-open-inlined-form is-editable{{/unless}}{{/if}}") + class="{{#if currentUser.isBoardMember}}{{#unless currentUser.isCommentOnly}}{{#unless currentUser.isWorker}}js-open-inlined-form is-editable{{/unless}}{{/unless}}{{/if}}") +viewer = title if wipLimit.enabled @@ -30,7 +30,6 @@ template(name="listHeader") if canSeeAddCard a.js-add-card.fa.fa-plus.list-header-plus-icon a.fa.fa-navicon.js-open-list-menu - a.list-header-handle.handle.fa.fa-arrows.js-list-handle else a.list-header-menu-icon.fa.fa-angle-right.js-select-list a.list-header-handle.handle.fa.fa-arrows.js-list-handle @@ -56,25 +55,47 @@ template(name="editListTitleForm") template(name="listActionPopup") ul.pop-over-list - li: a.js-toggle-watch-list {{#if isWatching}}{{_ 'unwatch'}}{{else}}{{_ 'watch'}}{{/if}} + li + a.js-toggle-watch-list + if isWatching + i.fa.fa-eye + | {{_ 'unwatch'}} + else + i.fa.fa-eye-slash + | {{_ 'watch'}} unless currentUser.isCommentOnly - hr - ul.pop-over-list - li: a.js-set-color-list {{_ 'set-color-list'}} - hr + unless currentUser.isWorker + ul.pop-over-list + li + a.js-set-color-list + i.fa.fa-paint-brush + | {{_ 'set-color-list'}} ul.pop-over-list if cards.count - li: a.js-select-cards {{_ 'list-select-cards'}} - hr + li + a.js-select-cards + i.fa.fa-check-square + | {{_ 'list-select-cards'}} if currentUser.isBoardAdmin ul.pop-over-list - li: a.js-set-wip-limit {{#if isWipLimitEnabled }}{{_ 'edit-wip-limit'}}{{else}}{{_ 'setWipLimitPopup-title'}}{{/if}} + li + a.js-set-wip-limit + i.fa.fa-ban + | {{#if isWipLimitEnabled }}{{_ 'edit-wip-limit'}}{{else}}{{_ 'setWipLimitPopup-title'}}{{/if}} + unless currentUser.isWorker hr - ul.pop-over-list - li: a.js-close-list {{_ 'archive-list'}} + ul.pop-over-list + li + a.js-close-list + i.fa.fa-arrow-right + i.fa.fa-archive + | {{_ 'archive-list'}} hr ul.pop-over-list - li: a.js-more {{_ 'listMorePopup-title'}} + li + a.js-more + i.fa.fa-link + | {{_ 'listMorePopup-title'}} template(name="boardLists") ul.pop-over-list @@ -94,7 +115,8 @@ template(name="listMorePopup") input.inline-input(type="text" readonly value="{{ rootUrl }}") | {{_ 'added'}} span.date(title=list.createdAt) {{ moment createdAt 'LLL' }} - a.js-delete {{_ 'delete'}} + unless currentUser.isWorker + a.js-delete {{_ 'delete'}} template(name="listDeletePopup") p {{_ "list-delete-pop"}} diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js index 570cc30f..46dbd748 100644 --- a/client/components/lists/listHeader.js +++ b/client/components/lists/listHeader.js @@ -9,9 +9,10 @@ BlazeComponent.extendComponent({ canSeeAddCard() { const list = Template.currentData(); return ( - !list.getWipLimit('enabled') || - list.getWipLimit('soft') || - !this.reachedWipLimit() + (!list.getWipLimit('enabled') || + list.getWipLimit('soft') || + !this.reachedWipLimit()) && + !Meteor.user().isWorker() ); }, @@ -109,12 +110,10 @@ Template.listHeader.helpers({ currentUser = Meteor.user(); if (currentUser) { return (currentUser.profile || {}).showDesktopDragHandles; + } else if (cookies.has('showDesktopDragHandles')) { + return true; } else { - if (cookies.has('showDesktopDragHandles')) { - return true; - } else { - return false; - } + return false; } }, }); |