luci-base: cbi: further refactoring
[project/luci.git] / modules / luci-base / luasrc / view / cbi / value.htm
1 <%+cbi/valueheader%>
2         <input data-update="change"<%=
3                 attr("id", cbid) ..
4                 attr("name", cbid) ..
5                 attr("type", self.password and "password" or "text") ..
6                 attr("class", self.password and "cbi-input-password" or "cbi-input-text") ..
7                 attr("value", self:cfgvalue(section) or self.default) ..
8                 ifattr(self.size, "size") ..
9                 ifattr(self.placeholder, "placeholder") ..
10                 ifattr(self.readonly, "readonly") ..
11                 ifattr(self.maxlength, "maxlength") ..
12                 ifattr(self.datatype, "data-type", self.datatype) ..
13                 ifattr(self.datatype, "data-optional", self.optional or self.rmempty) ..
14                 ifattr(self.combobox_manual, "data-manual", self.combobox_manual) ..
15                 ifattr(#self.keylist > 0, "data-choices", luci.util.serialize_json({ self.keylist, self.vallist }))
16         %> />
17         <% if self.password then %><img src="<%=resource%>/cbi/reload.gif" style="vertical-align:middle" title="<%:Reveal/hide password%>" onclick="var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" /><% end %>
18 <%+cbi/valuefooter%>