mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-06-02 18:31:43 +00:00

this adds an option to set the helplink on the global event also we now only set the link instead of the complete handler, which is now static and gets the url from a property (which we will set directly for other help buttons) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
/* help button pointing to an online documentation
|
|
for components contained in a modal window
|
|
*/
|
|
Ext.define('PVE.button.Help', {
|
|
extend: 'Ext.button.Button',
|
|
alias: 'widget.pveHelpButton',
|
|
text: gettext('Help'),
|
|
// make help button less flashy by styling it like toolbar buttons
|
|
iconCls: ' x-btn-icon-el-default-toolbar-small fa fa-question-circle',
|
|
cls: 'x-btn-default-toolbar-small pve-help-button',
|
|
hidden: true,
|
|
listenToGlobalEvent: true,
|
|
controller: {
|
|
xclass: 'Ext.app.ViewController',
|
|
listen: {
|
|
global: {
|
|
pveShowHelp: 'onPveShowHelp',
|
|
pveHideHelp: 'onPveHideHelp'
|
|
}
|
|
},
|
|
onPveShowHelp: function(helpLink) {
|
|
var me = this.getView();
|
|
if (me.listenToGlobalEvent === true) {
|
|
me.onlineHelp = helpLink;
|
|
me.show();
|
|
}
|
|
},
|
|
onPveHideHelp: function() {
|
|
var me = this.getView();
|
|
if (me.listenGlobalEvent === true) {
|
|
me.hide();
|
|
}
|
|
}
|
|
},
|
|
handler: function() {
|
|
var me = this;
|
|
if (me.onlineHelp) {
|
|
var docsURI = window.location.origin + '/pve-docs/' + me.onlineHelp;
|
|
window.open(docsURI);
|
|
} else {
|
|
Ext.Msg.alert(gettext('Help'), gettext('No Help available'));
|
|
}
|
|
}
|
|
});
|