branch/tag memorization

This commit is contained in:
gitlabhq 2011-10-14 18:08:25 +03:00
parent 912a383d9b
commit fc34fc86c6
5 changed files with 26 additions and 0 deletions

View file

@ -41,4 +41,13 @@ class ApplicationController < ActionController::Base
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

View file

@ -8,6 +8,7 @@ class CommitsController < ApplicationController
before_filter :authorize_read_project!
def index
refs_from_cookie
@repo = project.repo
@branch = if !params[:branch].blank?
params[:branch]

View file

@ -16,6 +16,7 @@ class ProjectsController < ApplicationController
end
def show
refs_from_cookie
@repo = project.repo
@commit = @repo.commits.first
@tree = @commit.tree
@ -32,6 +33,7 @@ class ProjectsController < ApplicationController
end
def tree
refs_from_cookie
@repo = project.repo
@branch = if !params[:branch].blank?
params[:branch]