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