OSDN Git Service

Revert "Handle back & forward events"
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>
Tue, 20 Dec 2011 06:49:14 +0000 (08:49 +0200)
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>
Tue, 20 Dec 2011 06:49:14 +0000 (08:49 +0200)
This reverts commit f80745b7dbcfa6aa41a37b34ec5a9e461231f7d6.

app/assets/javascripts/application.js
app/controllers/dashboard_controller.rb
app/controllers/refs_controller.rb
app/views/refs/_tree.html.haml

index 023c48d..04d4f0b 100644 (file)
@@ -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();
index b35cb83..39c7064 100644 (file)
@@ -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
index 1064f53..d2be5ad 100644 (file)
@@ -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
index 3a07168..07bab21 100644 (file)
     $('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;}});