diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-08-20 01:53:24 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-08-20 01:53:24 +0000 |
commit | 2903acf1f2b2a1dd7dbca14cd5b0ee9b2cf7be5e (patch) | |
tree | 012ebeaf1c41caa588832125e9f504ea7794efc9 /libs/cbi | |
parent | a0d353e3327a0b25f55800626a6143127b36de6b (diff) |
libs/cbi: preserve tab state across page reloads
Diffstat (limited to 'libs/cbi')
-rw-r--r-- | libs/cbi/htdocs/luci-static/resources/cbi.js | 2 | ||||
-rw-r--r-- | libs/cbi/luasrc/view/cbi/tabmenu.htm | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index 24f929c9bc..2e54ff7584 100644 --- a/libs/cbi/htdocs/luci-static/resources/cbi.js +++ b/libs/cbi/htdocs/luci-static/resources/cbi.js @@ -235,6 +235,7 @@ function cbi_t_add(section, tab) { function cbi_t_switch(section, tab) { if( cbi_t[section] && cbi_t[section][tab] ) { var o = cbi_t[section][tab]; + var h = document.getElementById('tab.' + section); for( var tid in cbi_t[section] ) { var o2 = cbi_t[section][tid]; if( o.tab.id != o2.tab.id ) { @@ -242,6 +243,7 @@ function cbi_t_switch(section, tab) { o2.container.style.display = 'none'; } else { + if(h) h.value = tab; o2.tab.className = o2.tab.className.replace(/(^| )cbi-tab-disabled( |$)/, " cbi-tab "); o2.container.style.display = 'block'; } diff --git a/libs/cbi/luasrc/view/cbi/tabmenu.htm b/libs/cbi/luasrc/view/cbi/tabmenu.htm index e9eb25dbf0..5cd5c76aaf 100644 --- a/libs/cbi/luasrc/view/cbi/tabmenu.htm +++ b/libs/cbi/luasrc/view/cbi/tabmenu.htm @@ -19,7 +19,7 @@ $Id$ <%- if not self.selected_tab then self.selected_tab = tab end %> <li id="tab.<%=self.config%>.<%=section%>.<%=tab%>" class="cbi-tab<%=(tab == self.selected_tab) and '' or '-disabled'%>"> <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> - <% if tab == self.selected_tab then %><input type="hidden" name="tab.<%=self.config%>.<%=section%>" value="<%=tab%>" /><% end %> + <% if tab == self.selected_tab then %><input type="hidden" id="tab.<%=self.config%>.<%=section%>" name="tab.<%=self.config%>.<%=section%>" value="<%=tab%>" /><% end %> </li> <% end end -%> </ul> |