Commit 6bdcaccb460cc349b68f34a24b61c782f9e5b2ac

Authored by Dmitriy Zaporozhets
1 parent f80745b7

Revert "Handle back & forward events"

This reverts commit f80745b7dbcfa6aa41a37b34ec5a9e461231f7d6.
app/assets/javascripts/application.js
... ... @@ -50,16 +50,8 @@ $(document).ready(function(){
50 50 e.preventDefault();
51 51 }
52 52 });
53   -});
54   -
55   -if (history && history.pushState) {
56   - $(function() {
57   - $(window).bind("popstate", function() {
58   - $.getScript(location.href);
59   - });
60 53  
61   - });
62   -}
  54 +});
63 55  
64 56 function focusSearch() {
65 57 $("#search").focus();
... ...
app/controllers/dashboard_controller.rb
... ... @@ -7,7 +7,7 @@ class DashboardController < ApplicationController
7 7  
8 8 respond_to do |format|
9 9 format.html
10   - format.js
  10 + format.js { no_cache_headers }
11 11 end
12 12 end
13 13  
... ... @@ -18,7 +18,7 @@ class DashboardController < ApplicationController
18 18  
19 19 respond_to do |format|
20 20 format.html
21   - format.js
  21 + format.js { no_cache_headers }
22 22 end
23 23 end
24 24  
... ... @@ -32,7 +32,7 @@ class DashboardController < ApplicationController
32 32  
33 33 respond_to do |format|
34 34 format.html
35   - format.js
  35 + format.js { no_cache_headers }
36 36 format.atom { render :layout => false }
37 37 end
38 38 end
... ...
app/controllers/refs_controller.rb
... ... @@ -26,7 +26,10 @@ class RefsController < ApplicationController
26 26 def tree
27 27 respond_to do |format|
28 28 format.html
29   - format.js
  29 + format.js do
  30 + # disable cache to allow back button works
  31 + no_cache_headers
  32 + end
30 33 end
31 34 rescue
32 35 return render_404
... ...
app/views/refs/_tree.html.haml
... ... @@ -49,3 +49,11 @@
49 49 $('select#branch').selectmenu({style:'popup', width:200});
50 50 $('select#tag').selectmenu({style:'popup', width:200});
51 51 });
  52 +
  53 +- if params[:path] && request.xhr?
  54 + :javascript
  55 + $(window).unbind('popstate');
  56 + $(window).bind('popstate', function() {
  57 + if(location.pathname.search("tree") != -1) {
  58 + $.ajax({type: "GET", url: location.pathname, dataType: "script"})}
  59 + else { location.href = location.pathname;}});
... ...