mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-08 23:05:10 +02:00
Replace all jquery-ui sortable used in fw
This commit is contained in:
@ -20,6 +20,7 @@ import {Et2Dialog} from "../etemplate/Et2Dialog/Et2Dialog";
|
||||
import {et2_nextmatch} from "../etemplate/et2_extension_nextmatch";
|
||||
import {et2_favorites} from "../etemplate/et2_widget_favorites";
|
||||
import {EGW_KEY_ENTER} from "../egw_action/egw_action_constants";
|
||||
import "sortablejs/Sortable.min.js";
|
||||
|
||||
/**
|
||||
* Common base class for application javascript
|
||||
@ -613,30 +614,22 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
|
||||
})
|
||||
.addClass("ui-helper-clearfix");
|
||||
|
||||
//Add Sortable handler to sideBox fav. menu
|
||||
jQuery('ul','#favorite_sidebox_'+this.appname).sortable({
|
||||
items:'li:not([data-id$="add"])',
|
||||
placeholder:'ui-fav-sortable-placeholder',
|
||||
delay:250, //(millisecond) delay before the sorting should start
|
||||
helper: function(event, item) {
|
||||
// We'll need to know which app this is for
|
||||
item.attr('data-appname',self.appname);
|
||||
// Create custom helper so it can be dragged to Home
|
||||
var h_parent = item.parent().parent().clone();
|
||||
h_parent.find('li').not('[data-id="'+item.attr('data-id')+'"]').remove();
|
||||
h_parent.appendTo('body');
|
||||
return h_parent;
|
||||
},
|
||||
refreshPositions: true,
|
||||
update: function (event, ui)
|
||||
let el = document.getElementById('favorite_sidebox_' + this.appname)?.getElementsByTagName('ul')[0];
|
||||
if(el && el instanceof HTMLElement)
|
||||
{
|
||||
let sortablejs = Sortable.create(el, {
|
||||
ghostClass: 'ui-fav-sortable-placeholder',
|
||||
draggable: 'li:not([data-id$="add"])',
|
||||
delay: 25,
|
||||
dataIdAttr: 'data-id',
|
||||
onSort: function(event)
|
||||
{
|
||||
var favSortedList = jQuery(this).sortable('toArray', {attribute:'data-id'});
|
||||
|
||||
self.egw.set_preference(self.appname,'fav_sort_pref',favSortedList);
|
||||
|
||||
let favSortedList = sortablejs.toArray();
|
||||
self.egw.set_preference(self.appname, 'fav_sort_pref', favSortedList);
|
||||
self._refresh_fav_nm();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Bind favorite de-select
|
||||
var egw_fw = egw_getFramework();
|
||||
|
Reference in New Issue
Block a user