diff options
Diffstat (limited to 'modules/luci-base/luasrc/view/cbi/value.htm')
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/value.htm | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/modules/luci-base/luasrc/view/cbi/value.htm b/modules/luci-base/luasrc/view/cbi/value.htm index 144853fd9f..6060310b19 100644 --- a/modules/luci-base/luasrc/view/cbi/value.htm +++ b/modules/luci-base/luasrc/view/cbi/value.htm @@ -1,26 +1,35 @@ <%+cbi/valueheader%> - <%- if self.password then -%> - <input type="password" style="position:absolute; left:-100000px" aria-hidden="true" tabindex="-1"<%= - attr("name", "password." .. cbid) - %> /> - <%- end -%> - <input data-update="change"<%= - attr("id", cbid) .. - attr("name", cbid) .. - attr("type", self.password and "password" or "text") .. - attr("class", self.password and "cbi-input-password" or "cbi-input-text") .. - attr("value", self:cfgvalue(section) or self.default) .. - ifattr(self.password, "autocomplete", "new-password") .. - ifattr(self.size, "size") .. - ifattr(self.placeholder, "placeholder") .. - ifattr(self.readonly, "readonly") .. - ifattr(self.maxlength, "maxlength") .. - ifattr(self.datatype, "data-type", self.datatype) .. - ifattr(self.datatype, "data-optional", self.optional or self.rmempty) .. - ifattr(self.combobox_manual, "data-manual", self.combobox_manual) .. - ifattr(#self.keylist > 0, "data-choices", { self.keylist, self.vallist }) - %> /> - <%- if self.password then -%> - <button class="cbi-button cbi-button-neutral" title="<%:Reveal/hide password%>" aria-label="<%:Reveal/hide password%>" onclick="var e = this.previousElementSibling; e.type = (e.type === 'password') ? 'text' : 'password'; event.preventDefault()">∗</button> - <% end %> + +<% local choices = self:choices() + if choices then %> + <div<%=attr("data-ui-widget", luci.util.serialize_json({ + "Combobox", self:cfgvalue(section) or self.default, choices, { + id = cbid, + name = cbid, + size = self.size, + sort = self.keylist, + datatype = self.datatype, + optional = self.optional or self.rmempty, + readonly = self.readonly, + maxlength = self.maxlength, + placeholder = self.placeholder, + custom_placeholder = self.combobox_manual + } + }))%>></div> +<% else %> + <div<%=attr("data-ui-widget", luci.util.serialize_json({ + "Textfield", self:cfgvalue(section) or self.default, { + id = cbid, + name = cbid, + size = self.size, + datatype = self.datatype, + optional = self.optional or self.rmempty, + password = self.password, + readonly = self.readonly, + maxlength = self.maxlength, + placeholder = self.placeholder + } + }))%>></div> +<% end %> + <%+cbi/valuefooter%> |