]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - button/HelpButton.js
1 /* help button pointing to an online documentation
2 for components contained in a modal window
7 Ext
.define('Proxmox.button.Help', {
8 extend
: 'Ext.button.Button',
9 xtype
: 'proxmoxHelpButton',
11 text
: gettext('Help'),
13 // make help button less flashy by styling it like toolbar buttons
14 iconCls
: ' x-btn-icon-el-default-toolbar-small fa fa-question-circle',
15 cls
: 'x-btn-default-toolbar-small proxmox-inline-button',
19 listenToGlobalEvent
: true,
22 xclass
: 'Ext.app.ViewController',
25 proxmoxShowHelp
: 'onProxmoxShowHelp',
26 proxmoxHideHelp
: 'onProxmoxHideHelp'
29 onProxmoxShowHelp: function(helpLink
) {
30 var me
= this.getView();
31 if (me
.listenToGlobalEvent
=== true) {
32 me
.setOnlineHelp(helpLink
);
36 onProxmoxHideHelp: function() {
37 var me
= this.getView();
38 if (me
.listenToGlobalEvent
=== true) {
44 getOnlineHelpInfo: function (ref
) {
46 if (typeof proxmoxOnlineHelpInfo
!== 'undefined') {
47 helpMap
= proxmoxOnlineHelpInfo
;
48 } else if (typeof pveOnlineHelpInfo
!== 'undefined') {
49 // be backward compatible with older pve-doc-generators
50 helpMap
= pveOnlineHelpInfo
;
52 throw "no global OnlineHelpInfo map declared";
58 // this sets the link and the tooltip text
59 setOnlineHelp:function(blockid
) {
62 var info
= me
.getOnlineHelpInfo(blockid
);
64 me
.onlineHelp
= blockid
;
65 var title
= info
.title
;
67 title
+= ' - ' + info
.subtitle
;
73 // helper to set the onlineHelp via a config object
74 setHelpConfig: function(config
) {
76 me
.setOnlineHelp(config
.onlineHelp
);
84 var info
= me
.getOnlineHelpInfo(me
.onlineHelp
);
86 docsURI
= window
.location
.origin
+ info
.link
;
93 Ext
.Msg
.alert(gettext('Help'), gettext('No Help available'));
97 initComponent: function() {
98 /*jslint confusion: true */
104 me
.setOnlineHelp(me
.onlineHelp
); // set tooltip