tabmap_nsections.htm 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <%- if firstmap and messages then local msg; for _, msg in ipairs(messages) do -%>
  2. <div class="errorbox"><%=pcdata(msg)%></div>
  3. <%- end end -%>
  4. <div class="cbi-map" id="cbi-<%=self.config%>">
  5. <% if self.title and #self.title > 0 then %>
  6. <h2 name="content"><%=self.title%></h2>
  7. <% end %>
  8. <% if self.description and #self.description > 0 then %>
  9. <div class="cbi-map-descr"><%=self.description%></div>
  10. <% end %>
  11. <%- if firstmap and (applymap or confirmmap) then -%>
  12. <%+cbi/apply_widget%>
  13. <% cbi_apply_widget() %>
  14. <div class="alert-message" id="cbi_apply_status" style="display:none"></div>
  15. <script>
  16. document.addEventListener("DOMContentLoaded", function() {
  17. <% if confirmmap then -%>
  18. uci_confirm(true, Date.now() + <%=confirmmap%> * 1000);
  19. <%- else -%>
  20. uci_apply(true);
  21. <%- end %>
  22. });
  23. </script>
  24. <%- end -%>
  25. <% if self.tabbed then %>
  26. <div>
  27. <% for i, section in ipairs(self.children) do
  28. tab = section.section or section.sectiontype %>
  29. <div class="cbi-tabcontainer"<%=
  30. attr("id", "container.m-%s.%s" %{ self.config, tab }) ..
  31. attr("data-tab", tab) ..
  32. attr("data-tab-title", section.title or tab)
  33. %>>
  34. <% section:render() %>
  35. </div>
  36. <% end %>
  37. </div>
  38. <% else %>
  39. <%- self:render_children() %>
  40. <% end %>
  41. <% if not self.save then -%>
  42. <div class="cbi-section-error">
  43. <% for _, section in ipairs(self.children) do %>
  44. <% if section.error and section.error[section.section] then -%>
  45. <ul><li>
  46. <%:One or more missing/invalid fields on tab%>:&#160;<%=section.title or section.section or section.sectiontype%>
  47. </li></ul>
  48. <%- end %>
  49. <% end %>
  50. </div>
  51. <%- end %>
  52. <br />
  53. </div>