summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-compat/luasrc/view/cbi/tsection.htm
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-11-03 20:49:31 +0100
committerJo-Philipp Wich <jo@mein.io>2019-11-03 20:49:31 +0100
commitd5dff8f9a5ca85d197cbb6037f95053bc55941e5 (patch)
treeeeb9271b96ba7b52bad777841ca4ebd452b1a2b0 /modules/luci-compat/luasrc/view/cbi/tsection.htm
parent9e57fbb2c3f9c44cdf0a57e6fb9c1df32c84d52b (diff)
treewide: move server side CBI support to luci-compat
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-compat/luasrc/view/cbi/tsection.htm')
-rw-r--r--modules/luci-compat/luasrc/view/cbi/tsection.htm52
1 files changed, 52 insertions, 0 deletions
diff --git a/modules/luci-compat/luasrc/view/cbi/tsection.htm b/modules/luci-compat/luasrc/view/cbi/tsection.htm
new file mode 100644
index 0000000000..8f3b7f0ffb
--- /dev/null
+++ b/modules/luci-compat/luasrc/view/cbi/tsection.htm
@@ -0,0 +1,52 @@
+<div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+ <% if self.title and #self.title > 0 then -%>
+ <legend><%=self.title%></legend>
+ <%- end %>
+ <% if self.error_msg and #self.error_msg > 0 then -%>
+ <div class="cbi-section-error">
+ <%=self.error_msg%>
+ </div>
+ <%- end %>
+ <% if self.description and #self.description > 0 then -%>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <%- end %>
+ <% local isempty = true for i, k in ipairs(self:cfgsections()) do -%>
+ <% if self.addremove then -%>
+ <div class="cbi-section-remove right">
+ <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" onclick="this.form.cbi_state='del-section'; return true" value="<%:Delete%>" class="cbi-button" />
+ </div>
+ <%- end %>
+
+ <%- section = k; isempty = false -%>
+
+ <% if not self.anonymous then -%>
+ <h3><%=section:upper()%></h3>
+ <%- end %>
+
+ <div class="cbi-section-node<% if self.tabs then %> cbi-section-node-tabbed<% end %>" id="cbi-<%=self.config%>-<%=section%>">
+ <%+cbi/ucisection%>
+ </div>
+ <%- end %>
+
+ <% if isempty then -%>
+ <em><%:This section contains no values yet%><br /><br /></em>
+ <%- end %>
+
+ <% if self.addremove then -%>
+ <% if self.template_addremove then include(self.template_addremove) else -%>
+ <div class="cbi-section-create">
+ <% if self.anonymous then -%>
+ <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
+ <%- else -%>
+ <% if self.invalid_cts then -%>
+ <div class="cbi-section-error"><%:Invalid%></div>
+ <%- end %>
+ <div>
+ <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." data-type="uciname" data-optional="true" />
+ </div>
+ <input class="cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
+ <%- end %>
+ </div>
+ <%- end %>
+ <%- end %>
+</div>