pve-manager/www/manager6/button/HelpButton.js
Emmanuel Kasper ecbca6c4c0 Add help button for PVE
This help button is meant to be added on InputPanels, where a
link to an online documentation chapter or subschapter is available.

Clicking on the help button will open the help in a new
browser tab.

Original idea similar to the pfSense GUI.
2016-06-01 12:30:25 +02:00

30 lines
720 B
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'),
iconCls: 'fa fa-question-circle',
hidden: true,
controller: {
xclass: 'Ext.app.ViewController',
listen: {
global: {
pveShowHelp: 'onPveShowHelp',
pveHideHelp: 'onPveHideHelp'
}
},
onPveShowHelp: function(helpLink) {
this.getView().setHandler(function() {
var docsURI = window.location.origin +
'/pve-docs/' + helpLink;
window.open(docsURI);
});
this.getView().show();
},
onPveHideHelp: function() {
this.getView().hide();
}
}
});