From 49157242edd4dc871b0f1b3b3625f82b98b3806b Mon Sep 17 00:00:00 2001 From: Marin Jankovski <maxlazio@gmail.com> Date: Tue, 30 Sep 2014 14:27:28 +0200 Subject: [PATCH] Save if user prefers readme or activity tab. --- app/assets/javascripts/project.js.coffee | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/assets/javascripts/project.js.coffee b/app/assets/javascripts/project.js.coffee index d81cc087df9..f4a8a178e76 100644 --- a/app/assets/javascripts/project.js.coffee +++ b/app/assets/javascripts/project.js.coffee @@ -51,3 +51,12 @@ $ -> $(@).toggleClass('on').find('.count').html(data.star_count) .on 'ajax:error', (e, xhr, status, error) -> new Flash('Star toggle failed. Try again later.', 'alert') + + $("a[data-toggle='tab']").on "shown.bs.tab", (e) -> + $.cookie "default_view", $(e.target).attr("href") + + defaultView = $.cookie("default_view") + if defaultView + $("a[href=" + defaultView + "]").tab "show" + else + $("a[data-toggle='tab']:first").tab "show" -- GitLab