libs/web: remove license comments from cbi templates, saves around 50% of their size
[project/luci.git] / libs / web / luasrc / view / cbi / dynlist.htm
1 <%+cbi/valueheader%>
2 <div>
3 <%
4         local vals = self:cfgvalue(section) or {}
5         for i=1, #vals + 1 do
6                 local val = vals[i]
7                 if (val and #val > 0) or (i == 1) then
8 %>
9         <input class="cbi-input-text" value="<%=pcdata(val)%>" onchange="cbi_d_update(this.id)" type="text"<%=
10                 attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size") ..
11                 ifattr(i == 1 and self.placeholder, "placeholder", self.placeholder)
12         %> /><br />
13 <% end end %>
14 </div>
15 <script type="text/javascript">
16 cbi_dynlist_init('<%=cbid%>', '<%=resource%>');
17 <% if self.datatype then -%>
18         <% if #self.keylist > 0 then -%>
19                 cbi_combobox_init('<%=cbid .. "." .. i%>', {
20                 <%- for i, k in ipairs(self.keylist) do -%>
21                         <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
22                         <%-if i<#self.keylist then-%>,<%-end-%>
23                 <%-     end     -%>
24                 }, '<%- if not self.rmempty and not self.optional then -%>
25                         <%-: -- Please choose -- -%>
26                 <%- end -%>', '<%: -- custom -- %>');
27         <% end -%>
28         <% for i=1, #vals + 1 do -%>
29         cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring((self.optional or self.rmempty) == true or i > #vals)%>, '<%=self.datatype%>');
30         <%- end %>
31 <% end -%>
32 </script>
33 <%+cbi/valuefooter%>