diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee index 784fefe1f..259554e34 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee @@ -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('
') @@ -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) -> diff --git a/app/assets/javascripts/app/views/generic/tabs.jst.eco b/app/assets/javascripts/app/views/generic/tabs.jst.eco index 03a62d8a1..d8042c453 100644 --- a/app/assets/javascripts/app/views/generic/tabs.jst.eco +++ b/app/assets/javascripts/app/views/generic/tabs.jst.eco @@ -1,6 +1,6 @@ -