luci-base: improve tab hide logic
[project/luci.git] / modules / luci-base / luasrc / view / cbi / tabmenu.htm
1 <%- if self.tabs then %>
2         <ul class="cbi-tabmenu">
3         <%- self.selected_tab = luci.http.formvalue("tab." .. self.config .. "." .. section) %>
4         <%- for _, tab in ipairs(self.tab_names) do if #self.tabs[tab].childs > 0 then %>
5                 <%- if not self.selected_tab then self.selected_tab = tab end %>
6                 <li id="tab.<%=self.config%>.<%=section%>.<%=tab%>" class="cbi-tab<%=(tab == self.selected_tab) and '' or '-disabled'%>">
7                         <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>
8                         <% if tab == self.selected_tab then %><input type="hidden" id="tab.<%=self.config%>.<%=section%>" name="tab.<%=self.config%>.<%=section%>" value="<%=tab%>" /><% end %>
9                 </li>
10         <% end end -%>
11         </ul>
12 <% end -%>