diff options
Diffstat (limited to 'client/components/cards/checklists.js')
-rw-r--r-- | client/components/cards/checklists.js | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/client/components/cards/checklists.js b/client/components/cards/checklists.js index 1a3a3265..2128b67d 100644 --- a/client/components/cards/checklists.js +++ b/client/components/cards/checklists.js @@ -4,11 +4,11 @@ function initSorting(items) { items.sortable({ tolerance: 'pointer', helper: 'clone', - items: '.js-checklist-item-handle:not(.placeholder)', + items: '.js-checklist-item:not(.placeholder)', connectWith: '.js-checklist-items', appendTo: '.board-canvas', distance: 7, - placeholder: 'checklist-item-handle placeholder', + placeholder: 'checklist-item placeholder', scroll: false, start(evt, ui) { ui.placeholder.height(ui.helper.height()); @@ -17,11 +17,11 @@ function initSorting(items) { stop(evt, ui) { const parent = ui.item.parents('.js-checklist-items'); const checklistId = Blaze.getData(parent.get(0)).checklist._id; - let prevItem = ui.item.prev('.js-checklist-item-handle').get(0); + let prevItem = ui.item.prev('.js-checklist-item').get(0); if (prevItem) { prevItem = Blaze.getData(prevItem).item; } - let nextItem = ui.item.next('.js-checklist-item-handle').get(0); + let nextItem = ui.item.next('.js-checklist-item').get(0); if (nextItem) { nextItem = Blaze.getData(nextItem).item; } @@ -38,7 +38,8 @@ function initSorting(items) { }); // ugly touch event hotfix - enableClickOnTouch('.js-checklist-item-handle:not(.placeholder)'); + enableClickOnTouch('.js-checklist-item:not(.placeholder)'); + } BlazeComponent.extendComponent({ @@ -60,6 +61,30 @@ BlazeComponent.extendComponent({ if ($itemsDom.data('sortable')) { $(self.itemsDom).sortable('option', 'disabled', !userIsMember()); } + if(Utils.isMiniScreen()) { + this.$('.js-checklists').sortable({ + handle: '.checklist-handle', + }); + this.$('.js-checklist-item').sortable({ + handle: '.checklist-item-handle', + }); + } else { + if (Meteor.user().hasShowDesktopDragHandles()) { + this.$('.js-checklists').sortable({ + handle: '.checklist-handle', + }); + this.$('.js-checklist-item').sortable({ + handle: '.checklist-item-handle', + }); + } else { + this.$('.js-checklists').sortable({ + handle: '.checklist-title', + }); + this.$('.js-checklist-item').sortable({ + handle: '.checklist-item', + }); + } + } }); }, @@ -72,6 +97,12 @@ BlazeComponent.extendComponent({ }, }).register('checklistDetail'); +Template.checklistDetail.helpers({ + showDesktopDragHandles() { + return Meteor.user().hasShowDesktopDragHandles(); + }, +}); + BlazeComponent.extendComponent({ addChecklist(event) { event.preventDefault(); |