Merge pull request #1794 from dibdot/adblock
[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 table.cbi-section-table th,
26 table.cbi-section-table td,
27 .cbi-section-table-cell,
28 .cbi-section-table-row,
29 .cbi-input-text
30 {
31         text-align:left;
32         vertical-align:top;
33         margin-right:auto;
34         margin-left:0px;
35 }
36 .cbi-input-text
37 {
38         outline:none;
39         box-shadow:none;
40         background:transparent;
41         padding-left:2px;
42         line-height:25px;
43         height:25px;
44         width:10em;
45 }
46 </style>
47
48 <fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
49         <% if self.title then -%>
50                 <legend><%=self.title%></legend>
51         <%- end %>
52         <div class="cbi-section-descr"><%=self.description%></div>
53         <div class="cbi-section-node">
54                 <table class="cbi-section-table">
55                         <tr class="cbi-section-table-titles">
56                         <%- if self.sectionhead then -%>
57                                 <th class="cbi-section-table-cell"><%=self.sectionhead%></th>
58                         <%- else -%>
59                                 <th>&#160;</th>
60                         <%- end -%>
61                         <%- for i, k in pairs(self.children) do -%>
62                                 <th class="cbi-section-table-cell"<%=width(k)%>>
63                                         <%-=k.title-%>
64                                 </th>
65                         <%- end -%>
66                         </tr>
67                         <%- local isempty = true
68                                 for i, k in ipairs(self:cfgsections()) do
69                                         section = k
70                                         isempty = false
71                                         scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
72                         -%>
73                         <tr class="cbi-section-table-row" id="cbi-<%=self.config%>-<%=section%>">
74                                 <th><%=k%></th>
75                                 <%-
76                                         for k, node in ipairs(self.children) do
77                                                 node:render(section, scope or {})
78                                         end
79                                         if not scope.cbid:match("adb_src_cat") then
80                                 -%>
81                                         <td class="cbi-value-field">&#160;</td>
82                                 <%- end -%>
83                         </tr>
84                         <%- end -%>
85                 </table>
86         </div>
87 </fieldset>