BigW Consortium Gitlab

Commit f51a4016 by Dmitriy Zaporozhets

branch/tag remember - to session instead of cookie

parent 5dc5ef7b
......@@ -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(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment