Commit 6bdcaccb460cc349b68f34a24b61c782f9e5b2ac
1 parent
f80745b7
Exists in
master
and in
4 other branches
Revert "Handle back & forward events"
This reverts commit f80745b7dbcfa6aa41a37b34ec5a9e461231f7d6.
Showing
4 changed files
with
16 additions
and
13 deletions
Show diff stats
app/assets/javascripts/application.js
| @@ -50,16 +50,8 @@ $(document).ready(function(){ | @@ -50,16 +50,8 @@ $(document).ready(function(){ | ||
| 50 | e.preventDefault(); | 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 | function focusSearch() { | 56 | function focusSearch() { |
| 65 | $("#search").focus(); | 57 | $("#search").focus(); |
app/controllers/dashboard_controller.rb
| @@ -7,7 +7,7 @@ class DashboardController < ApplicationController | @@ -7,7 +7,7 @@ class DashboardController < ApplicationController | ||
| 7 | 7 | ||
| 8 | respond_to do |format| | 8 | respond_to do |format| |
| 9 | format.html | 9 | format.html |
| 10 | - format.js | 10 | + format.js { no_cache_headers } |
| 11 | end | 11 | end |
| 12 | end | 12 | end |
| 13 | 13 | ||
| @@ -18,7 +18,7 @@ class DashboardController < ApplicationController | @@ -18,7 +18,7 @@ class DashboardController < ApplicationController | ||
| 18 | 18 | ||
| 19 | respond_to do |format| | 19 | respond_to do |format| |
| 20 | format.html | 20 | format.html |
| 21 | - format.js | 21 | + format.js { no_cache_headers } |
| 22 | end | 22 | end |
| 23 | end | 23 | end |
| 24 | 24 | ||
| @@ -32,7 +32,7 @@ class DashboardController < ApplicationController | @@ -32,7 +32,7 @@ class DashboardController < ApplicationController | ||
| 32 | 32 | ||
| 33 | respond_to do |format| | 33 | respond_to do |format| |
| 34 | format.html | 34 | format.html |
| 35 | - format.js | 35 | + format.js { no_cache_headers } |
| 36 | format.atom { render :layout => false } | 36 | format.atom { render :layout => false } |
| 37 | end | 37 | end |
| 38 | end | 38 | end |
app/controllers/refs_controller.rb
| @@ -26,7 +26,10 @@ class RefsController < ApplicationController | @@ -26,7 +26,10 @@ class RefsController < ApplicationController | ||
| 26 | def tree | 26 | def tree |
| 27 | respond_to do |format| | 27 | respond_to do |format| |
| 28 | format.html | 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 | end | 33 | end |
| 31 | rescue | 34 | rescue |
| 32 | return render_404 | 35 | return render_404 |
app/views/refs/_tree.html.haml
| @@ -49,3 +49,11 @@ | @@ -49,3 +49,11 @@ | ||
| 49 | $('select#branch').selectmenu({style:'popup', width:200}); | 49 | $('select#branch').selectmenu({style:'popup', width:200}); |
| 50 | $('select#tag').selectmenu({style:'popup', width:200}); | 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;}}); |