branch/tag remember - to session instead of cookie
This commit is contained in:
parent
fc34fc86c6
commit
2d577cae9d
|
@ -43,11 +43,14 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def refs_from_cookie
|
||||
# branch is high priority so we should reset
|
||||
# it if tag selected
|
||||
cookies[:branch] = nil if params[:tag]
|
||||
|
||||
params[:branch] ||= cookies[:branch]
|
||||
params[:tag] ||= cookies[:tag]
|
||||
if @project && session[:ui] &&
|
||||
session[:ui][@project.id]
|
||||
project_session = session[:ui][@project.id]
|
||||
project_session[:branch] = nil if params[:tag]
|
||||
params[:branch] ||= project_session[:branch]
|
||||
params[:tag] ||= project_session[:tag]
|
||||
end
|
||||
rescue
|
||||
session[:ui] = nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,4 +3,12 @@ module ProjectsHelper
|
|||
cookies["project_view"] ||= "tile"
|
||||
cookies["project_view"] == type ? nil : "display:none"
|
||||
end
|
||||
|
||||
def remember_refs
|
||||
session[:ui] ||= {}
|
||||
session[:ui][@project.id] = {
|
||||
:branch => params[:branch],
|
||||
:tag => params[:tag]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,9 +14,4 @@
|
|||
%div{:id => dom_id(@project)}
|
||||
= render "commits"
|
||||
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
$.cookie('branch', '#{params[:branch]}', { expires: 1 });
|
||||
$.cookie('tag', '#{params[:tag]}', { expires: 1 });
|
||||
});
|
||||
- remember_refs
|
||||
|
|
|
@ -46,11 +46,7 @@
|
|||
= render :partial => "projects/tree_item", :locals => { :content => content }
|
||||
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
$.cookie('branch', '#{params[:branch]}', { expires: 1 });
|
||||
$.cookie('tag', '#{params[:tag]}', { expires: 1 });
|
||||
});
|
||||
- remember_refs
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
|
|
Loading…
Reference in a new issue