forked from extern/egroupware
Adjust toolbar d-n-d, and add css class to actionbox dropdown menu
This commit is contained in:
parent
3bace4e0d7
commit
6c10d73e6e
@ -59,8 +59,8 @@ var et2_toolbar = et2_DOMWidget.extend(
|
|||||||
.attr('id',this.id +'-'+ 'actionbox');
|
.attr('id',this.id +'-'+ 'actionbox');
|
||||||
//actionlist is div for active actions
|
//actionlist is div for active actions
|
||||||
this.actionlist = $j(document.createElement('div'))
|
this.actionlist = $j(document.createElement('div'))
|
||||||
|
.addClass("et2_toolbar_actionlist")
|
||||||
.attr('id',this.id +'-'+ 'actionlist');
|
.attr('id',this.id +'-'+ 'actionlist');
|
||||||
|
|
||||||
this.countActions = 0;
|
this.countActions = 0;
|
||||||
this.dropdowns = {};
|
this.dropdowns = {};
|
||||||
@ -96,7 +96,7 @@ var et2_toolbar = et2_DOMWidget.extend(
|
|||||||
this.div.empty();
|
this.div.empty();
|
||||||
this.actionbox.empty();
|
this.actionbox.empty();
|
||||||
this.actionlist.empty();
|
this.actionlist.empty();
|
||||||
this.actionbox.append('<h></h>');
|
this.actionbox.append('<h class="ui-toolbar-menulistHeader">'+egw.lang('more...')+'</h>');
|
||||||
this.actionbox.append('<div id="' + this.id + '-menulist' +'" class="ui-toolbar-menulist" ></div>');
|
this.actionbox.append('<div id="' + this.id + '-menulist' +'" class="ui-toolbar-menulist" ></div>');
|
||||||
|
|
||||||
this.preference = egw.preference(this.id,this.egw().getAppName())?egw.preference(this.id,this.egw().getAppName()):this.preference;
|
this.preference = egw.preference(this.id,this.egw().getAppName())?egw.preference(this.id,this.egw().getAppName()):this.preference;
|
||||||
@ -190,13 +190,14 @@ var et2_toolbar = et2_DOMWidget.extend(
|
|||||||
var toolbar =jQuery('#'+this.id+'-'+'actionlist').find('button'),
|
var toolbar =jQuery('#'+this.id+'-'+'actionlist').find('button'),
|
||||||
toolbox = jQuery('#'+this.id+'-'+'actionbox'),
|
toolbox = jQuery('#'+this.id+'-'+'actionbox'),
|
||||||
menulist = jQuery('#'+this.id+'-'+'menulist');
|
menulist = jQuery('#'+this.id+'-'+'menulist');
|
||||||
|
var that = this;
|
||||||
toolbar.draggable({
|
toolbar.draggable({
|
||||||
cancel:true,
|
cancel:true,
|
||||||
//revert:"invalid",
|
//revert:"invalid",
|
||||||
containment: "document",
|
containment: "document",
|
||||||
cursor: "move",
|
cursor: "move",
|
||||||
helper: "clone",
|
helper: "clone",
|
||||||
|
appendTo:'body',
|
||||||
stop: function(event, ui){
|
stop: function(event, ui){
|
||||||
that._build_menu(actions);
|
that._build_menu(actions);
|
||||||
}
|
}
|
||||||
@ -205,10 +206,10 @@ var et2_toolbar = et2_DOMWidget.extend(
|
|||||||
cancel:true,
|
cancel:true,
|
||||||
containment:"document",
|
containment:"document",
|
||||||
helper:"clone",
|
helper:"clone",
|
||||||
|
appendTo:'body',
|
||||||
cursor:"move"
|
cursor:"move"
|
||||||
});
|
});
|
||||||
var that = this;
|
toolbox.children().droppable({
|
||||||
toolbox.droppable({
|
|
||||||
accept:toolbar,
|
accept:toolbar,
|
||||||
drop:function (event, ui) {
|
drop:function (event, ui) {
|
||||||
that.set_prefered(ui.draggable.attr('id').replace(that.id+'-',''),"add");
|
that.set_prefered(ui.draggable.attr('id').replace(that.id+'-',''),"add");
|
||||||
@ -219,7 +220,7 @@ var et2_toolbar = et2_DOMWidget.extend(
|
|||||||
egw.set_preference(that.egw().getAppName(),that.id,that.preference);
|
egw.set_preference(that.egw().getAppName(),that.id,that.preference);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tolerance:"pointer"
|
tolerance:"touch"
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery('#'+this.id+'-'+'actionlist').droppable({
|
jQuery('#'+this.id+'-'+'actionlist').droppable({
|
||||||
@ -272,7 +273,7 @@ var et2_toolbar = et2_DOMWidget.extend(
|
|||||||
.attr('id', this.id+'-'+action.id)
|
.attr('id', this.id+'-'+action.id)
|
||||||
.attr('title', action.caption)
|
.attr('title', action.caption)
|
||||||
.appendTo(this.preference[action.id]?this.actionbox.children()[1]:$j('[data-group='+action.group+']',this.actionlist));
|
.appendTo(this.preference[action.id]?this.actionbox.children()[1]:$j('[data-group='+action.group+']',this.actionlist));
|
||||||
|
|
||||||
if ( action.iconUrl && this.countActions > this.view_range )
|
if ( action.iconUrl && this.countActions > this.view_range )
|
||||||
{
|
{
|
||||||
button.attr('style','background-image:url(' + action.iconUrl + ')');
|
button.attr('style','background-image:url(' + action.iconUrl + ')');
|
||||||
|
Loading…
Reference in New Issue
Block a user