diff options
author | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-12-20 08:39:14 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-12-20 08:39:14 +0200 |
commit | f80745b7dbcfa6aa41a37b34ec5a9e461231f7d6 (patch) | |
tree | 088c4bb7e1dcfe5a22aa515e32f3605fccc714f5 /app | |
parent | 321dbb7bac5b2859cd5f30fdee7a1a2f39e122ae (diff) | |
download | gitlab-ce-f80745b7dbcfa6aa41a37b34ec5a9e461231f7d6.tar.gz |
Handle back & forward events
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/application.js | 10 | ||||
-rw-r--r-- | app/controllers/dashboard_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/refs_controller.rb | 5 | ||||
-rw-r--r-- | app/views/refs/_tree.html.haml | 8 |
4 files changed, 13 insertions, 16 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 04d4f0bc6cf..023c48d5d8d 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -50,9 +50,17 @@ $(document).ready(function(){ e.preventDefault(); } }); - }); +if (history && history.pushState) { + $(function() { + $(window).bind("popstate", function() { + $.getScript(location.href); + }); + + }); +} + function focusSearch() { $("#search").focus(); } diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 39c706488e5..b35cb8369b3 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -7,7 +7,7 @@ class DashboardController < ApplicationController respond_to do |format| format.html - format.js { no_cache_headers } + format.js end end @@ -18,7 +18,7 @@ class DashboardController < ApplicationController respond_to do |format| format.html - format.js { no_cache_headers } + format.js end end @@ -32,7 +32,7 @@ class DashboardController < ApplicationController respond_to do |format| format.html - format.js { no_cache_headers } + format.js format.atom { render :layout => false } end end diff --git a/app/controllers/refs_controller.rb b/app/controllers/refs_controller.rb index d2be5ad51db..1064f53e65d 100644 --- a/app/controllers/refs_controller.rb +++ b/app/controllers/refs_controller.rb @@ -26,10 +26,7 @@ class RefsController < ApplicationController def tree respond_to do |format| format.html - format.js do - # disable cache to allow back button works - no_cache_headers - end + format.js end rescue return render_404 diff --git a/app/views/refs/_tree.html.haml b/app/views/refs/_tree.html.haml index 07bab2129dc..3a07168a6de 100644 --- a/app/views/refs/_tree.html.haml +++ b/app/views/refs/_tree.html.haml @@ -49,11 +49,3 @@ $('select#branch').selectmenu({style:'popup', width:200}); $('select#tag').selectmenu({style:'popup', width:200}); }); - -- if params[:path] && request.xhr? - :javascript - $(window).unbind('popstate'); - $(window).bind('popstate', function() { - if(location.pathname.search("tree") != -1) { - $.ajax({type: "GET", url: location.pathname, dataType: "script"})} - else { location.href = location.pathname;}}); |