From 9d4849072901b2a4bcf3a99492ade1e1cb54930d Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 8 Jun 2018 07:29:44 +0200 Subject: luci-base: add markup, JS and CSS for new dropdown This commit introduces the required code for a new, markup based dropdown widget which can be used as a styleable alternative to select boxes or radio/checkbox button groups. Signed-off-by: Jo-Philipp Wich --- modules/luci-base/luasrc/view/cbi/dropdown.htm | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 modules/luci-base/luasrc/view/cbi/dropdown.htm (limited to 'modules/luci-base/luasrc/view/cbi') diff --git a/modules/luci-base/luasrc/view/cbi/dropdown.htm b/modules/luci-base/luasrc/view/cbi/dropdown.htm new file mode 100644 index 0000000000..bdf7248375 --- /dev/null +++ b/modules/luci-base/luasrc/view/cbi/dropdown.htm @@ -0,0 +1,42 @@ +<%+cbi/valueheader%> + +<%- + local selected = { } + + if self.multiple then + local val + for val in luci.util.imatch(self:cfgvalue(section)) do + selected[val] = true + end + else + selected[self:cfgvalue(section)] = true + end + + if not next(selected) and self.default then + selected[self.default] = true + end +-%> + +
> +
    + <% local i, key; for i, key in pairs(self.keylist) do %> + > + <%=pcdata(self.vallist[i])%> + + <% end %> +
+
+ +<%+cbi/valuefooter%> -- cgit v1.2.3