diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-08-08 08:24:02 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-08-14 22:58:15 +0200 |
commit | 3789148fc99f2c68525767689d65e6ad67292e0f (patch) | |
tree | 5d59a3b16cbbbfe9a0904cb4f3fcbddbbf8b5f4d | |
parent | f7a3546989d09b3a780a337a2b4126848ad432df (diff) |
luci-base: form.js: add further caption properties
Introduce properties `addbtntitle`, `removebtntitle` and `modaltitle` to
allow overriding the captions of section add buttons, remove buttons and
modal dialog titles respectively.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/form.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index ab0998943..1c1c9c8c9 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -649,8 +649,8 @@ var CBITypedSection = CBIAbstractSection.extend({ createEl.appendChild(E('input', { 'type': 'submit', 'class': 'cbi-button cbi-button-add', - 'value': _('Add'), - 'title': _('Add'), + 'value': this.addbtntitle || _('Add'), + 'title': this.addbtntitle || _('Add'), 'click': L.bind(this.handleAdd, this) })); } @@ -665,8 +665,8 @@ var CBITypedSection = CBIAbstractSection.extend({ E('input', { 'class': 'cbi-button cbi-button-add', 'type': 'submit', - 'value': _('Add'), - 'title': _('Add'), + 'value': this.addbtntitle || _('Add'), + 'title': this.addbtntitle || _('Add'), 'click': L.bind(function(ev) { if (nameEl.classList.contains('cbi-input-invalid')) return; @@ -957,8 +957,8 @@ var CBITableSection = CBITypedSection.extend({ L.dom.append(tdEl.lastElementChild, E('input', { 'type': 'submit', - 'value': _('Delete'), - 'title': _('Delete'), + 'value': this.removebtntitle || _('Delete'), + 'title': this.removebtntitle || _('Delete'), 'class': 'cbi-button cbi-button-remove', 'click': L.bind(function(sid, ev) { uci.remove(config_name, sid); @@ -1080,7 +1080,9 @@ var CBITableSection = CBITypedSection.extend({ s.tabs = this.tabs; s.tab_names = this.tab_names; - if (typeof(this.sectiontitle) == 'function') + if (typeof(this.modaltitle) == 'function') + title = this.stripTags(String(this.modaltitle(section_id) || '')), name = null; + else if (typeof(this.sectiontitle) == 'function') name = this.stripTags(String(this.sectiontitle(section_id) || '')); else if (!this.anonymous) name = section_id; |