mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Newer versions of jQuery sortable use uiSortable key
Newer versions of jQuery sortable use `uiSortable` as key to store the data. Let's adapt the code. While at it, refactor the code.
This commit is contained in:
parent
c1287248a6
commit
981ed546f1
4 changed files with 11 additions and 52 deletions
|
|
@ -278,17 +278,12 @@ BlazeComponent.extendComponent({
|
|||
|
||||
// Disable sorting if the current user is not a board member
|
||||
this.autorun(() => {
|
||||
if ($checklistsDom.data('sortable')) {
|
||||
$checklistsDom.sortable('option', 'disabled', !userIsMember());
|
||||
const disabled = !userIsMember() || Utils.isMiniScreen();
|
||||
if ($checklistsDom.data('uiSortable')) {
|
||||
$checklistsDom.sortable('option', 'disabled', disabled);
|
||||
}
|
||||
if ($subtasksDom.data('sortable')) {
|
||||
$subtasksDom.sortable('option', 'disabled', !userIsMember());
|
||||
}
|
||||
if ($checklistsDom.data('sortable')) {
|
||||
$checklistsDom.sortable('option', 'disabled', Utils.isMiniScreen());
|
||||
}
|
||||
if ($subtasksDom.data('sortable')) {
|
||||
$subtasksDom.sortable('option', 'disabled', Utils.isMiniScreen());
|
||||
if ($subtasksDom.data('uiSortable')) {
|
||||
$subtasksDom.sortable('option', 'disabled', disabled);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -57,11 +57,8 @@ BlazeComponent.extendComponent({
|
|||
// Disable sorting if the current user is not a board member
|
||||
self.autorun(() => {
|
||||
const $itemsDom = $(self.itemsDom);
|
||||
if ($itemsDom.data('sortable')) {
|
||||
$(self.itemsDom).sortable('option', 'disabled', !userIsMember());
|
||||
}
|
||||
if ($itemsDom.data('sortable')) {
|
||||
$(self.itemsDom).sortable('option', 'disabled', Utils.isMiniScreen());
|
||||
if ($itemsDom.data('uiSortable')) {
|
||||
$(self.itemsDom).sortable('option', 'disabled', !userIsMember() || Utils.isMiniScreen());
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -139,23 +139,12 @@ BlazeComponent.extendComponent({
|
|||
});
|
||||
}
|
||||
|
||||
if ($cards.data('sortable')) {
|
||||
if ($cards.data('uiSortable')) {
|
||||
$cards.sortable(
|
||||
'option',
|
||||
'disabled',
|
||||
// Disable drag-dropping when user is not member/is miniscreen
|
||||
!userIsMember(),
|
||||
// Not disable drag-dropping while in multi-selection mode
|
||||
// MultiSelection.isActive() || !userIsMember(),
|
||||
);
|
||||
}
|
||||
|
||||
if ($cards.data('sortable')) {
|
||||
$cards.sortable(
|
||||
'option',
|
||||
'disabled',
|
||||
// Disable drag-dropping when user is not member/is miniscreen
|
||||
Utils.isMiniScreen(),
|
||||
!userIsMember() || Utils.isMiniScreen(),
|
||||
// Not disable drag-dropping while in multi-selection mode
|
||||
// MultiSelection.isActive() || !userIsMember(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -122,34 +122,12 @@ function initSortable(boardComponent, $listsDom) {
|
|||
}
|
||||
|
||||
const $listDom = $listsDom;
|
||||
if ($listDom.data('sortable')) {
|
||||
if ($listDom.data('uiSortable')) {
|
||||
$listsDom.sortable(
|
||||
'option',
|
||||
'disabled',
|
||||
// Disable drag-dropping when user is not member/is worker/is miniscreen
|
||||
!userIsMember(),
|
||||
// Not disable drag-dropping while in multi-selection mode
|
||||
// MultiSelection.isActive() || !userIsMember(),
|
||||
);
|
||||
}
|
||||
|
||||
if ($listDom.data('sortable')) {
|
||||
$listsDom.sortable(
|
||||
'option',
|
||||
'disabled',
|
||||
// Disable drag-dropping when user is not member/is worker/is miniscreen
|
||||
Meteor.user().isWorker(),
|
||||
// Not disable drag-dropping while in multi-selection mode
|
||||
// MultiSelection.isActive() || !userIsMember(),
|
||||
);
|
||||
}
|
||||
|
||||
if ($listDom.data('sortable')) {
|
||||
$listsDom.sortable(
|
||||
'option',
|
||||
'disabled',
|
||||
// Disable drag-dropping when user is not member/is worker/is miniscreen
|
||||
Utils.isMiniScreen(),
|
||||
!userIsMember() || Meteor.user().isWorker() || Utils.isMiniScreen(),
|
||||
// Not disable drag-dropping while in multi-selection mode
|
||||
// MultiSelection.isActive() || !userIsMember(),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue