libs/cbi: implement tabbing to split large sections and group options in tabs
[project/luci.git] / libs / cbi / luasrc / view / cbi / tabmenu.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 $Id$
12
13 -%>
14
15 <%- if self.tabs then %>
16 <ul class="cbi-tabmenu">
17 <%- self.selected_tab = luci.http.formvalue("tab." .. self.config .. "." .. section) %>
18 <%- for _, tab in ipairs(self.tab_names) do if #self.tabs[tab].childs > 0 then %>
19 <%- if not self.selected_tab then self.selected_tab = tab end %>
20 <li id="tab.<%=self.config%>.<%=section%>.<%=tab%>" class="cbi-tab<%=(tab == self.selected_tab) and '' or '-disabled'%>">
21 <a onclick="this.blur(); return cbi_t_switch('<%=self.config%>.<%=section%>', '<%=tab%>')" href="<%=REQUEST_URI%>?tab.<%=self.config%>.<%=section%>=<%=tab%>"><%=self.tabs[tab].title%></a>
22 <% if tab == self.selected_tab then %><input type="hidden" name="tab.<%=self.config%>.<%=section%>" value="<%=tab%>" /><% end %>
23 </li>
24 <% end end -%>
25 </ul>
26 <% end -%>