From 002c4d1d5f583424b7d14cd84ecdda83f964b486 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 25 Jun 2018 11:12:25 +0200 Subject: [PATCH] luci-base: add "Name" label to autogenerated title column Signed-off-by: Jo-Philipp Wich --- .../luci-base/luasrc/view/cbi/tblsection.htm | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/modules/luci-base/luasrc/view/cbi/tblsection.htm b/modules/luci-base/luasrc/view/cbi/tblsection.htm index 348e9922b..ab1392204 100644 --- a/modules/luci-base/luasrc/view/cbi/tblsection.htm +++ b/modules/luci-base/luasrc/view/cbi/tblsection.htm @@ -15,6 +15,9 @@ function width(o) return '' end +local anonclass = (not self.anonymous or self.sectiontitle) and "named" or "anonymous" +local titlename = ifattr(not self.anonymous or self.sectiontitle, "data-title", translate("Name")) + -%> @@ -28,7 +31,7 @@ end
<%=self.description%>
<%- local count = 0 -%>
-
"> +
> <%- for i, k in pairs(self.children) do if not k.optional then -%>
<%- count = count + 1; end -%>
-
"> +
<%- for i, k in pairs(self.children) do if not k.optional then -%>
<%- end -%>
- <%- local isempty = true + <%- local isempty, i, k = true, nil, nil for i, k in ipairs(self:cfgsections()) do - section = k isempty = false - title = striptags((type(self.sectiontitle) == "function") and self:sectiontitle(section) or k) - scope = { + + local section = k + local sectionname = striptags((type(self.sectiontitle) == "function") and self:sectiontitle(section) or k) + local sectiontitle = ifattr(sectionname and (not self.anonymous or self.sectiontitle), "data-title", sectionname) + local colorclass = (self.extedit or self.rowcolors) and " cbi-rowstyle-%d" % rowstyle() or "" + local scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" } -%> -
> +
> <%- + local node for k, node in ipairs(self.children) do if not node.optional then node:render(section, scope or {}) -- 2.25.1