From 8e0ee137a67c3e924c2a3827968b6f3f1d7ce9f4 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 22 Jul 2018 17:40:07 +0200 Subject: luci-base: add description annotations to tblsection cells Add a "data-description" attribute to CBI fields which have a description set, this allows responsive design themes to render a field description when decomposing the table grid. Also reuse the precalculated "typename" property if it exists, instead of deriving it from the template name yet again. Signed-off-by: Jo-Philipp Wich --- modules/luci-base/luasrc/view/cbi/cell_valueheader.htm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules/luci-base/luasrc/view') diff --git a/modules/luci-base/luasrc/view/cbi/cell_valueheader.htm b/modules/luci-base/luasrc/view/cbi/cell_valueheader.htm index dbb0e1120..ea0568f40 100644 --- a/modules/luci-base/luasrc/view/cbi/cell_valueheader.htm +++ b/modules/luci-base/luasrc/view/cbi/cell_valueheader.htm @@ -1,10 +1,12 @@ <%- local title = luci.util.trim(striptags(self.title)) - local ftype = self.template and self.template:gsub("^.+/", "") + local descr = luci.util.trim(striptags(self.description)) + local ftype = self.typename or (self.template and self.template:gsub("^.+/", "")) -%>
0, "data-type", ftype) .. - ifattr(title and #title > 0, "data-title", title) + ifattr(title and #title > 0, "data-title", title) .. + ifattr(descr and #descr > 0, "data-description", descr) %>>
" data-index="<%=self.index%>" data-depends="<%=pcdata(self:deplist2json(section))%>"> -- cgit v1.2.3