From: Dmitriy Zaporozhets Date: Tue, 20 Dec 2011 06:49:14 +0000 (+0200) Subject: Revert "Handle back & forward events" X-Git-Tag: v2.0.0~3 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6bdcaccb460cc349b68f34a24b61c782f9e5b2ac;p=wvm%2Fgitlab.git Revert "Handle back & forward events" This reverts commit f80745b7dbcfa6aa41a37b34ec5a9e461231f7d6. --- diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 023c48d5d..04d4f0bc6 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -50,16 +50,8 @@ $(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 b35cb8369..39c706488 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 + format.js { no_cache_headers } end end @@ -18,7 +18,7 @@ class DashboardController < ApplicationController respond_to do |format| format.html - format.js + format.js { no_cache_headers } end end @@ -32,7 +32,7 @@ class DashboardController < ApplicationController respond_to do |format| format.html - format.js + format.js { no_cache_headers } format.atom { render :layout => false } end end diff --git a/app/controllers/refs_controller.rb b/app/controllers/refs_controller.rb index 1064f53e6..d2be5ad51 100644 --- a/app/controllers/refs_controller.rb +++ b/app/controllers/refs_controller.rb @@ -26,7 +26,10 @@ class RefsController < ApplicationController def tree respond_to do |format| format.html - format.js + format.js do + # disable cache to allow back button works + no_cache_headers + end end rescue return render_404 diff --git a/app/views/refs/_tree.html.haml b/app/views/refs/_tree.html.haml index 3a07168a6..07bab2129 100644 --- a/app/views/refs/_tree.html.haml +++ b/app/views/refs/_tree.html.haml @@ -49,3 +49,11 @@ $('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;}});