From d5dff8f9a5ca85d197cbb6037f95053bc55941e5 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 3 Nov 2019 20:49:31 +0100 Subject: treewide: move server side CBI support to luci-compat Signed-off-by: Jo-Philipp Wich --- modules/luci-compat/luasrc/view/cbi/ucisection.htm | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 modules/luci-compat/luasrc/view/cbi/ucisection.htm (limited to 'modules/luci-compat/luasrc/view/cbi/ucisection.htm') diff --git a/modules/luci-compat/luasrc/view/cbi/ucisection.htm b/modules/luci-compat/luasrc/view/cbi/ucisection.htm new file mode 100644 index 0000000000..8fa11d68f8 --- /dev/null +++ b/modules/luci-compat/luasrc/view/cbi/ucisection.htm @@ -0,0 +1,56 @@ +<%- + if type(self.hidden) == "table" then + for k, v in pairs(self.hidden) do +-%> + +<%- + end + end +%> + +<% if self.tabs then %> + <%+cbi/tabcontainer%> +<% else %> + <% self:render_children(section, scope or {}) %> +<% end %> + +<% if self.error and self.error[section] then -%> +
+
    <% for _, e in ipairs(self.error[section]) do -%> +
  • + <%- if e == "invalid" then -%> + <%:One or more fields contain invalid values!%> + <%- elseif e == "missing" then -%> + <%:One or more required fields have no value!%> + <%- else -%> + <%=pcdata(e)%> + <%- end -%> +
  • + <%- end %>
+
+<%- end %> + +<% if self.optionals[section] and #self.optionals[section] > 0 or self.dynamic then %> +
+ <%- + if self.dynamic then + local keys, vals, name, opt = { }, { } + for name, opt in pairs(self.optionals[section]) do + keys[#keys+1] = name + vals[#vals+1] = opt.title + end + -%> + 0, "data-choices", luci.util.json_encode({keys, vals})) + %> /> + <%- else -%> + + <%- end -%> + +
+<% end %> -- cgit v1.2.3