* luci/libs/cbi: various template cleanups
[project/luci.git] / libs / cbi / luasrc / view / cbi / tblsection.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15
16 <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
17 <h2><%=self.title%></h2>
18 <div class="cbi-section-descr"><%=self.description%></div>
19 <div class="cbi-section-node">
20 <%- local count = 0 -%>
21 <table class="cbi-section-table">
22 <tr class="cbi-section-table-titles">
23 <%- for i, k in pairs(self.children) do -%>
24 <th class="cbi-section-table-cell"><%=k.title%></th>
25 <%- count = count + 1; end; if self.addremove then -%>
26 <th class="cbi-section-table-cell">&nbsp;</th>
27 <%- count = count + 1; end -%>
28 </tr>
29 <tr class="cbi-section-table-descr">
30 <%- for i, k in pairs(self.children) do -%>
31 <th class="cbi-section-table-cell"><%=k.description%></th>
32 <%- end; if self.addremove then -%>
33 <th class="cbi-section-table-cell">&nbsp;</th>
34 <%- end -%>
35 </tr>
36 <%- for i, k in ipairs(self:cfgsections()) do
37 if not self.anonymous then
38 -%>
39 <tr class="cbi-section-table-title">
40 <th colspan="<%=count%>"><h3><%=k%></h3></th>
41 </tr>
42 <%- end
43 section = k
44 scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
45 -%>
46 <tr class="cbi-section-table-row" id="cbi-<%=self.config%>-<%=section%>">
47 <%-+cbi/ucisection-%>
48 <%- if self.addremove then -%>
49 <td class="cbi-section-table-cell">
50 <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="X" />
51 </td>
52 <%- end -%>
53 </tr>
54 <%- end -%>
55
56 <%- if self.addremove then -%>
57 <tr class="cbi-section-table-row">
58 <td colspan="<%=count%>" class="cbi-section-table-optionals">
59 <div class="cbi-section-create">
60 <% if self.anonymous then %>
61 <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add%>" />
62 <% else %>
63 <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
64 <input type="submit" value="<%:cbi_add%>" />
65 <% end %>
66
67 <% if self.err_invalid then %>
68 <div class="cbi-error"><%:cbi_invalid%></div>
69 <% end %>
70 </div>
71 </td>
72 </tr>
73 <%- end -%>
74 </table>
75 </div>
76 </div>