luci-base: make tooltip icon string configurable
authorFlorian Eckert <fe@dev.tdt.de>
Mon, 21 Dec 2020 15:31:43 +0000 (16:31 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Wed, 13 Jan 2021 11:29:02 +0000 (12:29 +0100)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
modules/luci-base/htdocs/luci-static/resources/form.js
modules/luci-base/htdocs/luci-static/resources/ui.js

index 4a4536bb9415d1008560e17a212d24dd29f46fe8..58a31dddb2ebce6af8be0965aa2df04b2d687e0f 100644 (file)
@@ -3616,6 +3616,17 @@ var CBIFlagValue = CBIValue.extend(/** @lends LuCI.form.FlagValue.prototype */ {
         * @default null
         */
 
+       /**
+        * Set a tooltip icon.
+        *
+        * If set, this icon will be shown for the default one.
+        * This could also be a png icon from the resources directory.
+        *
+        * @name LuCI.form.TypedSection.prototype#tooltipicon
+        * @type string
+        * @default 'ℹ️';
+        */
+
        /** @private */
        renderWidget: function(section_id, option_index, cfgvalue) {
                var tooltip = null;
@@ -3631,6 +3642,7 @@ var CBIFlagValue = CBIValue.extend(/** @lends LuCI.form.FlagValue.prototype */ {
                        value_disabled: this.disabled,
                        validate: L.bind(this.validate, this, section_id),
                        tooltip: tooltip,
+                       tooltipicon: this.tooltipicon,
                        disabled: (this.readonly != null) ? this.readonly : this.map.readonly
                });
 
index 81e0b8182008959a958c3f4a3b6d5dd486174c90..3ada9e375a61a480b35bf9f88ab920f5e54179b1 100644 (file)
@@ -611,9 +611,14 @@ var UICheckbox = UIElement.extend(/** @lends LuCI.ui.Checkbox.prototype */ {
                frameEl.appendChild(E('label', { 'for': id }));
 
                if (this.options.tooltip != null) {
+                       var icon = "⚠️";
+
+                       if (this.options.tooltipicon != null)
+                               icon = this.options.tooltipicon;
+
                        frameEl.appendChild(
                                E('label', { 'class': 'cbi-tooltip-container' },[
-                                       "⚠️",
+                                       icon,
                                        E('div', { 'class': 'cbi-tooltip' },
                                                this.options.tooltip
                                        )