[pve-devel] [PATCH manager 2/8] ConfigPanel: display help category in button

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Oct 17 11:48:00 CEST 2017


If there is a onlöineHelp set for the current active card then use
the card title, which is already translated and limited in length.
Else fall back to our parents onlineHelpTitle as we do that with the
help topic itself to, if not set just 'Help' gets displayed.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Acked-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/button/HelpButton.js | 12 +++++++++---
 www/manager6/panel/ConfigPanel.js |  6 +++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/www/manager6/button/HelpButton.js b/www/manager6/button/HelpButton.js
index 048a7d39..4fd3d163 100644
--- a/www/manager6/button/HelpButton.js
+++ b/www/manager6/button/HelpButton.js
@@ -36,9 +36,8 @@ Ext.define('PVE.button.Help', {
 	}
     },
 
-    // this sets the link and
-    // sets the tooltip text
-    setOnlineHelp:function(blockid) {
+    // this sets the link and the tooltip text
+    setOnlineHelp:function(blockid, category) {
 	var me = this;
 
 	var info = pveOnlineHelpInfo[blockid];
@@ -49,6 +48,13 @@ Ext.define('PVE.button.Help', {
 		title += ' - ' + info.subtitle;
 	    }
 	    me.setTooltip(title);
+
+	    var text = gettext('Help');
+	    if (category) {
+		// category should be already localised
+		text += ' (' + category + ')';
+	    }
+	    me.setText(text);
 	}
     },
 
diff --git a/www/manager6/panel/ConfigPanel.js b/www/manager6/panel/ConfigPanel.js
index c659af21..14478daa 100644
--- a/www/manager6/panel/ConfigPanel.js
+++ b/www/manager6/panel/ConfigPanel.js
@@ -128,7 +128,11 @@ Ext.define('PVE.panel.Config', {
 	if (me.savedItems[cardid]) {
 	    var curcard = me.getLayout().getActiveItem();
 	    var newcard = me.add(me.savedItems[cardid]);
-	    me.helpButton.setOnlineHelp(newcard.onlineHelp || me.onlineHelp);
+	    if (newcard.onlineHelp) {
+		me.helpButton.setOnlineHelp(newcard.onlineHelp, newcard.title);
+	    } else {
+		me.helpButton.setOnlineHelp(me.onlineHelp);
+	    }
 	    if (curcard) {
 		me.setActiveItem(cardid);
 		me.remove(curcard, true);
-- 
2.11.0





More information about the pve-devel mailing list