diff options
author | Christian Schoenebeck <christian.schoenebeck@gmail.com> | 2016-02-08 21:04:23 +0100 |
---|---|---|
committer | Christian Schoenebeck <christian.schoenebeck@gmail.com> | 2016-02-08 21:04:23 +0100 |
commit | 5fdfd903f485c551433ef88222b4739cbc617720 (patch) | |
tree | 83c175870bd5fb639696f9a2191590077194b645 /modules/luci-base/luasrc | |
parent | cde9a6234e637f9885406dad5592f56ccb5aee3a (diff) |
luci-base: fixed tabbed map when using NamedSection of same type
* fixed tabbed map when using NamedSection of same sectiontype
* add error message on which tab(s) the invalid/required fields are located
Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/map.htm | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/modules/luci-base/luasrc/view/cbi/map.htm b/modules/luci-base/luasrc/view/cbi/map.htm index 48403f1c3..e3210add6 100644 --- a/modules/luci-base/luasrc/view/cbi/map.htm +++ b/modules/luci-base/luasrc/view/cbi/map.htm @@ -14,20 +14,34 @@ <%- self.selected_tab = luci.http.formvalue("tab.m-" .. self.config) %> <% for i, section in ipairs(self.children) do %> <%- if not self.selected_tab then self.selected_tab = section.sectiontype end %> - <li id="tab.m-<%=self.config%>.<%=section.sectiontype%>" class="cbi-tab<%=(section.sectiontype == self.selected_tab) and '' or '-disabled'%>"> - <a onclick="this.blur(); return cbi_t_switch('m-<%=self.config%>', '<%=section.sectiontype%>')" href="<%=REQUEST_URI%>?tab.m-<%=self.config%>=<%=section.sectiontype%>"><%=section.title or section.sectiontype %></a> - <% if section.sectiontype == self.selected_tab then %><input type="hidden" id="tab.m-<%=self.config%>" name="tab.m-<%=self.config%>" value="<%=section.sectiontype%>" /><% end %> + <li id="tab.m-<%=self.config%>.<%=section.section or section.sectiontype%>" class="cbi-tab<%=(section.sectiontype == self.selected_tab) and '' or '-disabled'%>"> + <a onclick="this.blur(); return cbi_t_switch('m-<%=self.config%>', '<%=section.section or section.sectiontype%>')" href="<%=REQUEST_URI%>?tab.m-<%=self.config%>=<%=section.section or section.sectiontype%>"><%=section.title or section.section or section.sectiontype %></a> + <% if section.sectiontype == self.selected_tab then %><input type="hidden" id="tab.m-<%=self.config%>" name="tab.m-<%=self.config%>" value="<%=section.section or section.sectiontype%>" /><% end %> </li> <% end %> </ul> + <br /> <% for i, section in ipairs(self.children) do %> - <div class="cbi-tabcontainer" id="container.m-<%=self.config%>.<%=section.sectiontype%>"<% if section.sectiontype ~= self.selected_tab then %> style="display:none"<% end %>> + <div class="cbi-tabcontainer" id="container.m-<%=self.config%>.<%=section.section or section.sectiontype%>"<% if section.sectiontype ~= self.selected_tab then %> style="display:none"<% end %>> <% section:render() %> </div> - <script type="text/javascript">cbi_t_add('m-<%=self.config%>', '<%=section.sectiontype%>')</script> + <script type="text/javascript">cbi_t_add('m-<%=self.config%>', '<%=section.section or section.sectiontype%>')</script> <% end %> + + <% if not self.save then -%> + <div class="cbi-section-error"> + <% for _, section in ipairs(self.children) do %> + <% if section.error and section.error[section.section] then -%> + <ul><li> + <%:One or more invalid/required values on tab%>: <%=section.title or section.section or section.sectiontype%> + </li></ul> + <%- end %> + <% end %> + </div> + <%- end %> <% else %> <%- self:render_children() %> <% end %> + <br /> </div> |