mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-04 05:44:32 +01:00
Implement toggle button in toolbar widget, representing checkbox actions in toolbar
This commit is contained in:
parent
458aed9262
commit
733fd41a45
@ -232,7 +232,7 @@ var et2_toolbar = et2_DOMWidget.extend([et2_IInput],
|
|||||||
dropdown.set_select_options(children);
|
dropdown.set_select_options(children);
|
||||||
dropdown.set_label (action.caption);
|
dropdown.set_label (action.caption);
|
||||||
|
|
||||||
dropdown.set_image (action.iconUrl);
|
dropdown.set_image (action.iconUrl||'');
|
||||||
dropdown.onchange = jQuery.proxy(function(selected, dropdown)
|
dropdown.onchange = jQuery.proxy(function(selected, dropdown)
|
||||||
{
|
{
|
||||||
var action = that._actionManager.getActionById(selected.attr('data-id'));
|
var action = that._actionManager.getActionById(selected.attr('data-id'));
|
||||||
@ -382,6 +382,11 @@ var et2_toolbar = et2_DOMWidget.extend([et2_IInput],
|
|||||||
.attr('title', (action.hint ? action.hint : action.caption))
|
.attr('title', (action.hint ? action.hint : 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 && action.checkbox)
|
||||||
|
{
|
||||||
|
var action_event = typeof this._actionManager != 'undefined'?this._actionManager.getActionById(action.id):null;
|
||||||
|
if (action_event && action_event.checked) button.addClass('toolbar_toggled');
|
||||||
|
}
|
||||||
if ( action.iconUrl)
|
if ( action.iconUrl)
|
||||||
{
|
{
|
||||||
button.attr('style','background-image:url(' + action.iconUrl + ')');
|
button.attr('style','background-image:url(' + action.iconUrl + ')');
|
||||||
@ -407,7 +412,12 @@ var et2_toolbar = et2_DOMWidget.extend([et2_IInput],
|
|||||||
var click = function(e)
|
var click = function(e)
|
||||||
{
|
{
|
||||||
var action = this._actionManager.getActionById(e.data);
|
var action = this._actionManager.getActionById(e.data);
|
||||||
if(action)
|
if (action && action.checkbox)
|
||||||
|
{
|
||||||
|
action.set_checked(!action.checked);
|
||||||
|
jQuery(button).toggleClass('toolbar_toggled');
|
||||||
|
}
|
||||||
|
else if(action)
|
||||||
{
|
{
|
||||||
this.value = action.id;
|
this.value = action.id;
|
||||||
action.data.event = e;
|
action.data.event = e;
|
||||||
|
Loading…
Reference in New Issue
Block a user