summaryrefslogtreecommitdiffstats
path: root/client/components/lists
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-10-03 04:23:33 +0300
committerLauri Ojansivu <x@xet7.org>2019-10-03 04:23:33 +0300
commit5bc355f9a5e78df4c19764fdc4a343a46af4fdf8 (patch)
tree619057d5fecfa4c041f5bbd99fd069b103e72123 /client/components/lists
parent21fa26a1be7cee947ea02de2ffd89bfd4e4b2f36 (diff)
downloadwekan-5bc355f9a5e78df4c19764fdc4a343a46af4fdf8.tar.gz
wekan-5bc355f9a5e78df4c19764fdc4a343a46af4fdf8.tar.bz2
wekan-5bc355f9a5e78df4c19764fdc4a343a46af4fdf8.zip
Drag handles. In progress.
Diffstat (limited to 'client/components/lists')
-rw-r--r--client/components/lists/list.js39
1 files changed, 21 insertions, 18 deletions
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();
+ },
+});