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