From: Paul Donald Date: Mon, 2 Feb 2026 17:40:26 +0000 (+0100) Subject: luci-base: actions title for actions buttons group X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=da19afa0bd809978ae22d2fef7d584bf4b405c7c;p=openwrt-luci.git luci-base: actions title for actions buttons group Customizable title. Signed-off-by: Paul Donald --- diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 0464b9ef71..b2a0ca5f7a 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -2474,6 +2474,15 @@ const CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection * @default null */ + /** + * Set a custom text for the actions column header row when actions buttons + * are present. + * + * @name LuCI.form.TableSection.prototype#actionstitle + * @type string|function + * @default null + */ + /** * Specify a maximum amount of columns to display. By default, one table * column is rendered for each child option of the form section element. @@ -2715,10 +2724,13 @@ const CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection dom.content(trEl.lastElementChild, opt.title); } - if (this.sortable || this.extedit || this.addremove || has_more || has_action || this.cloneable) + if (this.sortable || this.extedit || this.addremove || has_more || has_action || this.cloneable) { + const rawTitle = (this.actionstitle !== undefined) ? this.actionstitle : null; + const actionsTitle = (typeof rawTitle === 'function') ? rawTitle.call(this, has_action) : rawTitle; trEl.appendChild(E('th', { 'class': 'th cbi-section-table-cell cbi-section-actions' - })); + }, (actionsTitle !== undefined) ? actionsTitle : null)); + } trEls.appendChild(trEl); } @@ -2742,10 +2754,13 @@ const CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection (typeof(opt.width) == 'number') ? `${opt.width}px` : opt.width; } - if (this.sortable || this.extedit || this.addremove || has_more || has_action || this.cloneable) + if (this.sortable || this.extedit || this.addremove || has_more || has_action || this.cloneable) { + const rawTitle = (this.actionstitle !== undefined) ? this.actionstitle : null; + const actionsTitle = (typeof rawTitle === 'function') ? rawTitle.call(this, has_action) : rawTitle; trEl.appendChild(E('th', { 'class': 'th cbi-section-table-cell cbi-section-actions' - })); + }, (actionsTitle !== undefined) ? actionsTitle : null)); + } trEls.appendChild(trEl); }