summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/view/cbi
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-10-25 17:04:03 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-10-25 17:04:03 +0000
commit70706cf388f8ac100778831e9ef9d7b1eb74c752 (patch)
tree096cada604879e8806762a050fd176b9b592f24c /libs/web/luasrc/view/cbi
parenteecec8b0f2a2cd86827115c1479de974ece00850 (diff)
libs/web: rework DynamicList widget
Diffstat (limited to 'libs/web/luasrc/view/cbi')
-rw-r--r--libs/web/luasrc/view/cbi/dynlist.htm47
-rw-r--r--libs/web/luasrc/view/cbi/full_valuefooter.htm2
2 files changed, 20 insertions, 29 deletions
diff --git a/libs/web/luasrc/view/cbi/dynlist.htm b/libs/web/luasrc/view/cbi/dynlist.htm
index 826e2e698e..9ca7534738 100644
--- a/libs/web/luasrc/view/cbi/dynlist.htm
+++ b/libs/web/luasrc/view/cbi/dynlist.htm
@@ -13,40 +13,31 @@ $Id$
-%>
<%+cbi/valueheader%>
+<div>
<%
local vals = self:cfgvalue(section) or {}
for i=1, #vals + 1 do
local val = vals[i]
%>
- <input class="cbi-input-text" value="<%=pcdata(val)%>" onchange="cbi_d_update(this.id)" type="text"<%= attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size")%> />
- <% if i <= #vals then %>
- <input class="cbi-input-image" type="image" value="<%:Delete%>" name="cbi.rle.<%=section .. "." .. self.option .. "." .. i%>" alt="<%:Delete%>" title="<%:Delete%>" src="<%=resource%>/cbi/remove.gif" />
- <% else %>
- <input class="cbi-input-image" type="image" value="<%:Add%>" name="cbi.ale.<%=section .. "." .. self.option%>" alt="<%:Add%>" title="<%:Add%>" src="<%=resource%>/cbi/add.gif" />
- <% end %>
+ <input class="cbi-input-text" value="<%=pcdata(val)%>" onchange="cbi_d_update(this.id)" type="text"<%= attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size")%> /><br />
+<% end %>
+</div>
+<script type="text/javascript">
+cbi_dynlist_init('<%=cbid%>');
+<% if self.datatype then -%>
<% if #self.keylist > 0 then -%>
- <script type="text/javascript">
- cbi_combobox_init('<%=cbid .. "." .. i%>', {
- <%-
- for i, k in ipairs(self.keylist) do
- -%>
- <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
- <%-if i<#self.keylist then-%>,<%-end-%>
- <%-
- end
- -%>
- }, '<%- if not self.rmempty and not self.optional then -%>
- <%-:cbi_select-%>
- <%- end -%>', '<%: -- custom -- %>');
- </script>
+ cbi_combobox_init('<%=cbid .. "." .. i%>', {
+ <%- for i, k in ipairs(self.keylist) do -%>
+ <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
+ <%-if i<#self.keylist then-%>,<%-end-%>
+ <%- end -%>
+ }, '<%- if not self.rmempty and not self.optional then -%>
+ <%-:cbi_select-%>
+ <%- end -%>', '<%: -- custom -- %>');
<% end -%>
-<% if i <= #vals then %><br />
-<% end end %>
-<% if self.datatype then -%>
- <script type="text/javascript">
- <% for i=1, #vals + 1 do -%>
- cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring(self.optional == true or i > #vals)%>, '<%=self.datatype%>');
- <%- end %>
- </script>
+ <% for i=1, #vals + 1 do -%>
+ cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring(self.optional == true or i > #vals)%>, '<%=self.datatype%>');
+ <%- end %>
<% end -%>
+</script>
<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/full_valuefooter.htm b/libs/web/luasrc/view/cbi/full_valuefooter.htm
index c069b7f92c..18b2f2d76e 100644
--- a/libs/web/luasrc/view/cbi/full_valuefooter.htm
+++ b/libs/web/luasrc/view/cbi/full_valuefooter.htm
@@ -14,7 +14,7 @@ $Id$
-%>
<% if self.description and #self.description > 0 then -%>
- <% if not luci.util.instanceof( self, luci.cbi.Flag ) or self.orientation == "horizontal" then -%>
+ <% if not luci.util.instanceof(self, luci.cbi.DynamicList) and (not luci.util.instanceof(self, luci.cbi.Flag) or self.orientation == "horizontal") then -%>
<br />
<%- end %>
<div class="cbi-value-description">