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

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Oct 10 12:49:02 CEST 2017


If there is a onlineHelp set for the current active card then use
the card title, which is already translated and limited in length.
---
 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