super
end
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]
+ end
end
before_filter :authorize_read_project!
def index
+ refs_from_cookie
@repo = project.repo
@branch = if !params[:branch].blank?
params[:branch]
end
def show
+ refs_from_cookie
@repo = project.repo
@commit = @repo.commits.first
@tree = @commit.tree
end
def tree
+ refs_from_cookie
@repo = project.repo
@branch = if !params[:branch].blank?
params[:branch]
%h3{:style => "color:#555"} /#{params[:path]}
%div{:id => dom_id(@project)}
= render "commits"
+
+
+:javascript
+ $(function(){
+ $.cookie('branch', '#{params[:branch]}', { expires: 1 });
+ $.cookie('tag', '#{params[:tag]}', { expires: 1 });
+ });
- contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content|
= render :partial => "projects/tree_item", :locals => { :content => content }
+
+:javascript
+ $(function(){
+ $.cookie('branch', '#{params[:branch]}', { expires: 1 });
+ $.cookie('tag', '#{params[:tag]}', { expires: 1 });
+ });
+
:javascript
$(function(){
$('select#branch').selectmenu({style:'popup', width:200});