mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-26 12:51:52 +02:00
Apply favorites sortable feature to sidebox fav. menu
This commit is contained in:
parent
3b89284023
commit
c912849bd5
@ -177,20 +177,6 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Add Sortable handler to sideBox fav. menu
|
|
||||||
$j(this.sidebox_target.children()).sortable({
|
|
||||||
|
|
||||||
items:'li:not([data-id$="add"])',
|
|
||||||
placeholder:'ui-fav-sortable-placeholder',
|
|
||||||
update: function (event, ui)
|
|
||||||
{
|
|
||||||
self.favSortedList = jQuery(this).sortable('toArray', {attribute:'data-id'});
|
|
||||||
|
|
||||||
self.egw().set_preference(self.options.app,'fav_sort_pref',self.favSortedList);
|
|
||||||
self.init_filters(self,self.load_favorites(self.options.app));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add a listener on the delete to remove
|
// Add a listener on the delete to remove
|
||||||
this.menu.on("click","div.ui-icon-trash", app[self.options.app], function() {
|
this.menu.on("click","div.ui-icon-trash", app[self.options.app], function() {
|
||||||
// App instance might not be ready yet, so don't bind directly
|
// App instance might not be ready yet, so don't bind directly
|
||||||
|
@ -319,6 +319,21 @@ var AppJS = Class.extend(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.addClass("ui-helper-clearfix");
|
.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',
|
||||||
|
update: function (event, ui)
|
||||||
|
{
|
||||||
|
var favSortedList = jQuery(this).sortable('toArray', {attribute:'data-id'});
|
||||||
|
|
||||||
|
self.egw.set_preference(self.appname,'fav_sort_pref',favSortedList);
|
||||||
|
|
||||||
|
self._refresh_fav_nm();
|
||||||
|
}
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -395,6 +410,31 @@ var AppJS = Class.extend(
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update favorite items in nm fav. menu
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
_refresh_fav_nm: function ()
|
||||||
|
{
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
if(etemplate2 && etemplate2.getByApplication)
|
||||||
|
{
|
||||||
|
var et2 = etemplate2.getByApplication(self.appname);
|
||||||
|
for(var i = 0; i < et2.length; i++)
|
||||||
|
{
|
||||||
|
et2[i].widgetContainer.iterateOver(function(_widget) {
|
||||||
|
_widget.stored_filters = _widget.load_favorites(self.appname);
|
||||||
|
_widget.init_filters(_widget);
|
||||||
|
}, self, et2_favorites);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Error ("_refresh_fav_nm():Either et2 is not ready/ not there yet. Make sure that etemplate2 is ready before call this method.");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the "Add new" popup dialog
|
* Create the "Add new" popup dialog
|
||||||
*/
|
*/
|
||||||
@ -522,17 +562,7 @@ var AppJS = Class.extend(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to update nextmatch favorites too
|
// Try to update nextmatch favorites too
|
||||||
if(etemplate2 && etemplate2.getByApplication)
|
self._refresh_fav_nm();
|
||||||
{
|
|
||||||
var et2 = etemplate2.getByApplication(self.appname);
|
|
||||||
for(var i = 0; i < et2.length; i++)
|
|
||||||
{
|
|
||||||
et2[i].widgetContainer.iterateOver(function(_widget) {
|
|
||||||
_widget.stored_filters = _widget.load_favorites(self.appname);
|
|
||||||
_widget.init_filters(_widget);
|
|
||||||
}, self, et2_favorites);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Reset form
|
// Reset form
|
||||||
delete self.favorite_popup.state;
|
delete self.favorite_popup.state;
|
||||||
@ -617,19 +647,7 @@ var AppJS = Class.extend(
|
|||||||
// Remove line from list
|
// Remove line from list
|
||||||
line.slideUp("slow", function() { });
|
line.slideUp("slow", function() { });
|
||||||
|
|
||||||
// Try to update nextmatch favorites too
|
trash._refresh_fav_nm();
|
||||||
if(etemplate2 && etemplate2.getByApplication)
|
|
||||||
{
|
|
||||||
var et2 = etemplate2.getByApplication(app.appname);
|
|
||||||
for(var i = 0; i < et2.length; i++)
|
|
||||||
{
|
|
||||||
et2[i].widgetContainer.iterateOver(function(_widget) {
|
|
||||||
var faves = _widget.load_favorites(app.appname);
|
|
||||||
delete faves[id];
|
|
||||||
_widget.init_filters(_widget,faves);
|
|
||||||
}, app, et2_favorites);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user