Explorar el Código

Make it compatible with newer and older versions of jQuery sortable

While at it, fix comments and prettify it.
Marc Hartmayer hace 5 años
padre
commit
6d1cdebfe2

+ 2 - 2
client/components/cards/cardDetails.js

@@ -279,10 +279,10 @@ BlazeComponent.extendComponent({
     // Disable sorting if the current user is not a board member
     // Disable sorting if the current user is not a board member
     this.autorun(() => {
     this.autorun(() => {
       const disabled = !userIsMember() || Utils.isMiniScreen();
       const disabled = !userIsMember() || Utils.isMiniScreen();
-      if ($checklistsDom.data('uiSortable')) {
+      if ($checklistsDom.data('uiSortable') || $checklistsDom.data('sortable')) {
         $checklistsDom.sortable('option', 'disabled', disabled);
         $checklistsDom.sortable('option', 'disabled', disabled);
       }
       }
-      if ($subtasksDom.data('uiSortable')) {
+      if ($subtasksDom.data('uiSortable') || $subtasksDom.data('sortable')) {
         $subtasksDom.sortable('option', 'disabled', disabled);
         $subtasksDom.sortable('option', 'disabled', disabled);
       }
       }
     });
     });

+ 7 - 3
client/components/cards/checklists.js

@@ -54,11 +54,15 @@ BlazeComponent.extendComponent({
       return Meteor.user() && Meteor.user().isBoardMember();
       return Meteor.user() && Meteor.user().isBoardMember();
     }
     }
 
 
-    // Disable sorting if the current user is not a board member
+    // Disable sorting if the current user is not a board member or is a miniscreen
     self.autorun(() => {
     self.autorun(() => {
       const $itemsDom = $(self.itemsDom);
       const $itemsDom = $(self.itemsDom);
-      if ($itemsDom.data('uiSortable')) {
-        $(self.itemsDom).sortable('option', 'disabled', !userIsMember() || Utils.isMiniScreen());
+      if ($itemsDom.data('uiSortable') || $itemsDom.data('sortable')) {
+        $(self.itemsDom).sortable(
+          'option',
+          'disabled',
+          !userIsMember() || Utils.isMiniScreen(),
+        );
       }
       }
     });
     });
   },
   },

+ 1 - 1
client/components/lists/list.js

@@ -139,7 +139,7 @@ BlazeComponent.extendComponent({
         });
         });
       }
       }
 
 
-      if ($cards.data('uiSortable')) {
+      if ($cards.data('uiSortable') || $cards.data('sortable')) {
         $cards.sortable(
         $cards.sortable(
           'option',
           'option',
           'disabled',
           'disabled',

+ 1 - 1
client/components/swimlanes/swimlanes.js

@@ -122,7 +122,7 @@ function initSortable(boardComponent, $listsDom) {
     }
     }
 
 
     const $listDom = $listsDom;
     const $listDom = $listsDom;
-    if ($listDom.data('uiSortable')) {
+    if ($listDom.data('uiSortable') || $listDom.data('sortable')) {
       $listsDom.sortable(
       $listsDom.sortable(
         'option',
         'option',
         'disabled',
         'disabled',