summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2016-01-15 17:42:40 +0100
committerJo-Philipp Wich <jow@openwrt.org>2016-01-15 17:42:40 +0100
commit1bf268de06c1697fdf08b65dcc13c06b4bed909f (patch)
treeb95af5b2dd0df6b6042db05df9f1793894db0bff /modules/luci-base/luasrc
parent27281dca56fd1c7fb03efd70f9d0f5dfc5f869d2 (diff)
luci-base: add basic support for CBI map level tabbing
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r--modules/luci-base/luasrc/view/cbi/map.htm23
1 files changed, 22 insertions, 1 deletions
diff --git a/modules/luci-base/luasrc/view/cbi/map.htm b/modules/luci-base/luasrc/view/cbi/map.htm
index e90c3f589f..7f256adf13 100644
--- a/modules/luci-base/luasrc/view/cbi/map.htm
+++ b/modules/luci-base/luasrc/view/cbi/map.htm
@@ -8,6 +8,27 @@
<% if self.title and #self.title > 0 then %><h2 name="content"><%=self.title%></h2><% end %>
<% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
<%- if firstmap and applymap then cbi_apply_xhr(self.config, parsechain, redirect) end -%>
- <%- self:render_children() %>
+
+ <% if self.tabbed then %>
+ <ul class="cbi-tabmenu">
+ <%- self.selected_tab = luci.http.formvalue("tab.m-" .. self.config) %>
+ <% for i, section in ipairs(self.children) do %>
+ <script type="text/javascript">cbi_c['container.m-<%=self.config%>.<%=section.sectiontype%>'] = 1;</script>
+ <%- 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>
+ <% end %>
+ </ul>
+ <% 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 %>>
+ <% section:render() %>
+ </div>
+ <script type="text/javascript">cbi_t_add('m-<%=self.config%>', '<%=section.sectiontype%>')</script>
+ <% end %>
+ <% else %>
+ <%- self:render_children() %>
+ <% end %>
<br />
</div>