diff options
author | Florian Eckert <fe@dev.tdt.de> | 2020-12-21 16:31:43 +0100 |
---|---|---|
committer | Florian Eckert <fe@dev.tdt.de> | 2021-01-13 12:29:02 +0100 |
commit | df2a135a08def546f44158d97fbaee5a544a6899 (patch) | |
tree | 51bf381dadb84a41b9666f036f9c4d99d2605a14 /modules/luci-base/htdocs | |
parent | e951236e3634924e2a26bf5d0890b3f25d39115d (diff) |
luci-base: make tooltip icon string configurable
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'modules/luci-base/htdocs')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/form.js | 12 | ||||
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 7 |
2 files changed, 18 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 4a4536bb94..58a31dddb2 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -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 }); diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 81e0b81820..3ada9e375a 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -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 ) |