[common] refactoring
This commit is contained in:
parent
15431b1eae
commit
a0616e8f17
|
@ -573,6 +573,13 @@ define([
|
||||||
this.trigger('toggle', this, state);
|
this.trigger('toggle', this, state);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
click: function(opts) {
|
||||||
|
if ( !this.disabled ) {
|
||||||
|
this.doToggle();
|
||||||
|
this.trigger('click', this, opts);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
isActive: function() {
|
isActive: function() {
|
||||||
if (this.enableToggle)
|
if (this.enableToggle)
|
||||||
return this.pressed;
|
return this.pressed;
|
||||||
|
|
|
@ -104,13 +104,11 @@ define([
|
||||||
if (/button:click/.test(cmd)) {
|
if (/button:click/.test(cmd)) {
|
||||||
var obj = JSON.parse(param);
|
var obj = JSON.parse(param);
|
||||||
if ( !!obj.action ) {
|
if ( !!obj.action ) {
|
||||||
// TODO: add method 'click' to button
|
titlebuttons[obj.action].btn.click();
|
||||||
titlebuttons[obj.action].btn.cmpEl.trigger({type:'click',which:1});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// app.execCommand('webapps:events', 'loading');
|
|
||||||
// app.execCommand('window:features', {version: config.version, action: 'request'});
|
// app.execCommand('window:features', {version: config.version, action: 'request'});
|
||||||
app.execCommand('webapps:features', {version: config.version, eventloading:true, titlebuttons:true});
|
app.execCommand('webapps:features', {version: config.version, eventloading:true, titlebuttons:true});
|
||||||
}
|
}
|
||||||
|
@ -125,7 +123,7 @@ define([
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var _onTitleButtonDasabled = function (action, e, status) {
|
var _onTitleButtonDisabled = function (action, e, status) {
|
||||||
titlebuttons[action].disabled = status;
|
titlebuttons[action].disabled = status;
|
||||||
var _buttons = {};
|
var _buttons = {};
|
||||||
_buttons[action] = status;
|
_buttons[action] = status;
|
||||||
|
@ -174,12 +172,9 @@ define([
|
||||||
'redo': {btn: header.btnRedo, disabled:false}
|
'redo': {btn: header.btnRedo, disabled:false}
|
||||||
};
|
};
|
||||||
|
|
||||||
var toolbar = webapp.getController('Toolbar').getView();
|
for (var i in titlebuttons) {
|
||||||
if ( toolbar ) {
|
titlebuttons[i].btn.options.signals = ['disabled'];
|
||||||
toolbar.btnUndo.on('disabled', _onTitleButtonDasabled.bind(this, 'undo'));
|
titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i));
|
||||||
toolbar.btnRedo.on('disabled', _onTitleButtonDasabled.bind(this, 'redo'));
|
|
||||||
toolbar.btnSave.on('disabled', _onTitleButtonDasabled.bind(this, 'save'));
|
|
||||||
toolbar.btnPrint.on('disabled', _onTitleButtonDasabled.bind(this, 'print'));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue