* luci/libs/cbi: fix html errors in cbi templates
[project/luci.git] / libs / cbi / luasrc / view / cbi / tblsection.htm
index a557c58..b0da081 100644 (file)
@@ -89,19 +89,6 @@ end
                                        </td>
                                <%- end -%>
                        </tr>
-                       <% if self.tag_deperror[section] or self.tag_invalid[section] or self.tag_error[section] then %>
-                               <tr class="cbi-section-table-row">
-                                       <td colspan="<%=count%>">
-                               <%- if self.tag_deperror[section] then -%>
-                                       <div class="cbi-error"><%:cbi_deperror%></div>
-                               <%- elseif self.tag_invalid[section] then -%>
-                                       <div class="cbi-error"><%:cbi_invalid_section%></div>
-                               <%- elseif self.tag_error[section] then -%>
-                                       <div class="cbi-error"><%=self.tag_error[section]%></div>
-                               <%- end -%>
-                                       </td>
-                               </tr>
-                       <% end %>
                        <%- end -%>
 
                        <%- if isempty then -%>
@@ -110,24 +97,29 @@ end
                        </tr>
                        <%- end -%>
                </table>
-                       <%- if self.addremove then -%>
-                       <div class="cbi-section-table-row">
-                               <td colspan="<%=count%>" class="cbi-section-table-optionals">
-                                       <div class="cbi-section-create">
-                                               <% if self.anonymous then %>
-                                                       <input class="cbi-button cbi-button-add" type="submit" value="<%:cbi_add%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" title="<%:cbi_add%>" />
-                                               <% else %>
-                                                       <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
-                                                       <input class="cbi-button cbi-button-add" type="submit" value="<%:cbi_add%>" title="<%:cbi_add%>" />
-                                               <% end %>
 
-                                               <% if self.err_invalid then %>
-                                                       <div class="cbi-error"><%:cbi_invalid%></div>
-                                               <% end %>
-                                       </div>
-                               </td>
+               <% if self.error then %>
+                       <div class="cbi-section-error">
+                               <ul><% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%>
+                                       <li><%=luci.util.pcdata(e):gsub("\n","<br />")%></li>
+                               <%- end end %></ul>
                        </div>
-                       <%- end -%>
+               <% end %>
+
+               <%- if self.addremove then -%>
+               <div class="cbi-section-create">
+                       <% if self.anonymous then %>
+                               <input class="cbi-button cbi-button-add" type="submit" value="<%:cbi_add%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" title="<%:cbi_add%>" />
+                       <% else %>
+                               <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
+                               <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+                               <input class="cbi-button cbi-button-add" type="submit" value="<%:cbi_add%>" title="<%:cbi_add%>" />
+                               <% if self.invalid_cts then -%>
+                                       <br /><%:cbi_invalid%></div>
+                               <%- end %>
+                       <% end %>
+               </div>
+               <%- end -%>
        </div>
 </fieldset>
 <!-- /tblsection -->