From 5bc355f9a5e78df4c19764fdc4a343a46af4fdf8 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Thu, 3 Oct 2019 04:23:33 +0300 Subject: Drag handles. In progress. --- client/components/lists/list.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'client/components/lists/list.js') diff --git a/client/components/lists/list.js b/client/components/lists/list.js index a134a00a..fa70179b 100644 --- a/client/components/lists/list.js +++ b/client/components/lists/list.js @@ -31,24 +31,6 @@ BlazeComponent.extendComponent({ const itemsSelector = '.js-minicard:not(.placeholder, .js-card-composer)'; const $cards = this.$('.js-minicards'); - if (Utils.isMiniScreen) { - $('.js-minicards').sortable({ - handle: '.handle', - }); - } - - if (!Utils.isMiniScreen && showDesktopDragHandles) { - $('.js-minicards').sortable({ - handle: '.handle', - }); - } - - if (!Utils.isMiniScreen && !showDesktopDragHandles) { - $('.js-minicards').sortable({ - handle: 'list-header', - }); - } - $cards.sortable({ connectWith: '.js-minicards:not(.js-list-full)', tolerance: 'pointer', @@ -138,6 +120,21 @@ BlazeComponent.extendComponent({ // Disable drag-dropping if the current user is not a board member or is comment only this.autorun(() => { $cards.sortable('option', 'disabled', !userIsMember()); + if (Utils.isMiniScreen()) { + this.$('.js-minicards').sortable({ + handle: '.handle', + }); + } else { + if (Meteor.user().hasShowDesktopDragHandles()) { + this.$('.js-minicards').sortable({ + handle: '.handle', + }); + } else { + this.$('.js-minicards').sortable({ + handle: '.minicard-title', + }); + } + } }); // We want to re-run this function any time a card is added. @@ -180,3 +177,9 @@ Template.miniList.events({ Session.set('currentList', listId); }, }); + +Template.miniList.helpers({ + showDesktopDragHandles() { + return Meteor.user().hasShowDesktopDragHandles(); + }, +}); -- cgit v1.2.3-1-g7c22