Fixed lost tab after setting has changed.
This commit is contained in:
parent
604f4c918e
commit
03a1d880d0
2 changed files with 15 additions and 4 deletions
|
@ -269,14 +269,17 @@ class App.ControllerLevel2 extends App.ControllerContent
|
|||
# window.scrollTo(0,0)
|
||||
|
||||
class App.ControllerTabs extends App.Controller
|
||||
events:
|
||||
'click .nav-tabs [data-toggle="tab"]': 'tabRemember',
|
||||
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
render: ->
|
||||
|
||||
@html App.view('generic/tabs')(
|
||||
tabs: @tabs
|
||||
)
|
||||
@el.find('.nav-tabs li:first').addClass('active')
|
||||
|
||||
for tab in @tabs
|
||||
@el.find('.tab-content').append('<div class="tab-pane" id="' + tab.target + '"></div>')
|
||||
|
@ -285,7 +288,15 @@ class App.ControllerTabs extends App.Controller
|
|||
params.el = @el.find( '#' + tab.target )
|
||||
new tab.controller( params )
|
||||
|
||||
@el.find('.tab-content .tab-pane:first').addClass('active')
|
||||
@lastActiveTab = @Config.get('lastTab')
|
||||
if @lastActiveTab && @el.find('.nav-tabs li a[href="' + @lastActiveTab + '"]')[0]
|
||||
@el.find('.nav-tabs li a[href="' + @lastActiveTab + '"]').tab('show')
|
||||
else
|
||||
@el.find('.nav-tabs li:first a').tab('show')
|
||||
|
||||
tabRemember: (e) =>
|
||||
@lastActiveTab = $(e.target).attr('href')
|
||||
@Config.set('lastTab', @lastActiveTab)
|
||||
|
||||
class App.ControllerNavSidbar extends App.ControllerContent
|
||||
constructor: (params) ->
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<ul class="nav nav-tabs">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<% for tab in @tabs: %>
|
||||
<li><a href="#<%= tab.target %>" data-toggle="tab"><%- @T( tab.name ) %></a></li>
|
||||
<li><a href="#<%= tab.target %>" role="tab" data-toggle="tab"><%- @T( tab.name ) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="tab-content"></div>
|
Loading…
Reference in a new issue