Handle back & forward events
This commit is contained in:
parent
321dbb7bac
commit
f80745b7db
4 changed files with 13 additions and 16 deletions
|
@ -50,8 +50,16 @@ $(document).ready(function(){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (history && history.pushState) {
|
||||||
|
$(function() {
|
||||||
|
$(window).bind("popstate", function() {
|
||||||
|
$.getScript(location.href);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function focusSearch() {
|
function focusSearch() {
|
||||||
$("#search").focus();
|
$("#search").focus();
|
||||||
|
|
|
@ -7,7 +7,7 @@ class DashboardController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.js { no_cache_headers }
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class DashboardController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.js { no_cache_headers }
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class DashboardController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.js { no_cache_headers }
|
format.js
|
||||||
format.atom { render :layout => false }
|
format.atom { render :layout => false }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,10 +26,7 @@ class RefsController < ApplicationController
|
||||||
def tree
|
def tree
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.js do
|
format.js
|
||||||
# disable cache to allow back button works
|
|
||||||
no_cache_headers
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
return render_404
|
return render_404
|
||||||
|
|
|
@ -49,11 +49,3 @@
|
||||||
$('select#branch').selectmenu({style:'popup', width:200});
|
$('select#branch').selectmenu({style:'popup', width:200});
|
||||||
$('select#tag').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;}});
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue