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 <jo@mein.io>
(cherry picked from commit 8e0ee137a6
)
This commit is contained in:
parent
03b6d77ee3
commit
81682971dc
1 changed files with 4 additions and 2 deletions
|
@ -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("^.+/", ""))
|
||||
-%>
|
||||
<div class="td cbi-value-field<% if self.error and self.error[section] then %> cbi-value-error<% end %>"<%=
|
||||
attr("data-name", self.option) ..
|
||||
ifattr(ftype and #ftype > 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)
|
||||
%>>
|
||||
<div id="cbi-<%=self.config.."-"..section.."-"..self.option%>" data-index="<%=self.index%>" data-depends="<%=pcdata(self:deplist2json(section))%>">
|
||||
|
|
Loading…
Reference in a new issue