luci-app-adblock: sync with adblock 3.4.1
[project/luci.git] / applications / luci-app-adblock / luasrc / view / adblock / blocklist.htm
1 <%#
2 Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
3 This is free software, licensed under the Apache License, Version 2.0
4 -%>
5
6 <%-
7 local rowcnt = 1
8 function rowstyle()
9         rowcnt = rowcnt + 1
10         return (rowcnt % 2) + 1
11 end
12
13 function width(o)
14         if o.width then
15                 if type(o.width) == 'number' then
16                         return ' style="width:%dpx"' % o.width
17                 end
18                 return ' style="width:%s"' % o.width
19         end
20         return ''
21 end
22 -%>
23
24 <style type="text/css">
25 <!--
26 .cbi-section-table-cell,
27 .cbi-section-table-row
28 {
29         text-align:left;
30         margin-right:auto;
31         margin-left:0px;
32 }
33 -->
34 </style>
35
36 <fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
37         <% if self.title then -%>
38                 <legend><%=self.title%></legend>
39         <%- end %>
40         <div class="cbi-section-descr"><%=self.description%></div>
41         <div class="cbi-section-node">
42                 <%- local count = 0 -%>
43                 <table class="cbi-section-table">
44                         <tr class="cbi-section-table-titles">
45                         <%- if self.sectionhead then -%>
46                                 <th class="cbi-section-table-cell"><%=self.sectionhead%></th>
47                         <%- else -%>
48                                 <th>&#160;</th>
49                         <%- end -%>
50                         <%- for i, k in pairs(self.children) do -%>
51                                 <th class="cbi-section-table-cell"<%=width(k)%>>
52                                         <%-=k.title-%>
53                                 </th>
54                         <%- count = count + 1; end; -%>
55                         </tr>
56                         <%- local isempty = true
57                                 for i, k in ipairs(self:cfgsections()) do
58                                         section = k
59                                         isempty = false
60                                         scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
61                         -%>
62                         <tr class="cbi-section-table-row" id="cbi-<%=self.config%>-<%=section%>">
63                                         <th><%=k%></th>
64                                 <%-
65                                         for k, node in ipairs(self.children) do
66                                                 if not node.optional then
67                                                         node:render(section, scope or {})
68                                                 end
69                                         end
70                                 -%>
71                         </tr>
72                         <%- end -%>
73                         <%- if isempty then -%>
74                         <tr class="cbi-section-table-row">
75                                 <td colspan="<%=count%>"><em><br /><%:This section contains no values yet%></em></td>
76                         </tr>
77                         <%- end -%>
78                 </table>
79         </div>
80 </fieldset>