luci-base: make tooltip icon string configurable
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
e951236e36
commit
df2a135a08
2 changed files with 18 additions and 1 deletions
|
@ -3616,6 +3616,17 @@ var CBIFlagValue = CBIValue.extend(/** @lends LuCI.form.FlagValue.prototype */ {
|
||||||
* @default null
|
* @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 */
|
/** @private */
|
||||||
renderWidget: function(section_id, option_index, cfgvalue) {
|
renderWidget: function(section_id, option_index, cfgvalue) {
|
||||||
var tooltip = null;
|
var tooltip = null;
|
||||||
|
@ -3631,6 +3642,7 @@ var CBIFlagValue = CBIValue.extend(/** @lends LuCI.form.FlagValue.prototype */ {
|
||||||
value_disabled: this.disabled,
|
value_disabled: this.disabled,
|
||||||
validate: L.bind(this.validate, this, section_id),
|
validate: L.bind(this.validate, this, section_id),
|
||||||
tooltip: tooltip,
|
tooltip: tooltip,
|
||||||
|
tooltipicon: this.tooltipicon,
|
||||||
disabled: (this.readonly != null) ? this.readonly : this.map.readonly
|
disabled: (this.readonly != null) ? this.readonly : this.map.readonly
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -611,9 +611,14 @@ var UICheckbox = UIElement.extend(/** @lends LuCI.ui.Checkbox.prototype */ {
|
||||||
frameEl.appendChild(E('label', { 'for': id }));
|
frameEl.appendChild(E('label', { 'for': id }));
|
||||||
|
|
||||||
if (this.options.tooltip != null) {
|
if (this.options.tooltip != null) {
|
||||||
|
var icon = "⚠️";
|
||||||
|
|
||||||
|
if (this.options.tooltipicon != null)
|
||||||
|
icon = this.options.tooltipicon;
|
||||||
|
|
||||||
frameEl.appendChild(
|
frameEl.appendChild(
|
||||||
E('label', { 'class': 'cbi-tooltip-container' },[
|
E('label', { 'class': 'cbi-tooltip-container' },[
|
||||||
"⚠️",
|
icon,
|
||||||
E('div', { 'class': 'cbi-tooltip' },
|
E('div', { 'class': 'cbi-tooltip' },
|
||||||
this.options.tooltip
|
this.options.tooltip
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue