From: Jo-Philipp Wich Date: Thu, 20 Aug 2009 01:53:24 +0000 (+0000) Subject: libs/cbi: preserve tab state across page reloads X-Git-Tag: 0.10.0~1162 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=2903acf1f2b2a1dd7dbca14cd5b0ee9b2cf7be5e libs/cbi: preserve tab state across page reloads --- diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index 24f929c9b..2e54ff758 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 e9eb25dbf..5cd5c76aa 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 %>
  • <%=self.tabs[tab].title%> - <% if tab == self.selected_tab then %><% end %> + <% if tab == self.selected_tab then %><% end %>
  • <% end end -%>