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