REpostiry, Team models

This commit is contained in:
Dmitriy Zaporozhets 2013-01-03 21:09:18 +02:00
parent e6c0673ef1
commit 39ba934c0a
31 changed files with 329 additions and 315 deletions

View file

@ -76,6 +76,12 @@ class ApplicationController < ActionController::Base
end
end
def repository
@repository ||= project.repository
rescue Grit::NoSuchPathError
nil
end
def add_abilities
abilities << Ability
end

View file

@ -9,10 +9,10 @@ class CommitsController < ProjectResourceController
before_filter :require_non_empty_project
def show
@repo = @project.repo
@repo = @project.repository
@limit, @offset = (params[:limit] || 40), (params[:offset] || 0)
@commits = @project.commits(@ref, @path, @limit, @offset)
@commits = @repo.commits(@ref, @path, @limit, @offset)
@commits = CommitDecorator.decorate(@commits)
respond_to do |format|

View file

@ -1,3 +1,4 @@
class ProjectResourceController < ApplicationController
before_filter :project
before_filter :repository
end

View file

@ -31,7 +31,7 @@ class RefsController < ProjectResourceController
contents = @tree.contents
@logs = contents.map do |content|
file = params[:path] ? File.join(params[:path], content.name) : content.name
last_commit = @project.commits(@commit.id, file, 1).last
last_commit = @repo.commits(@commit.id, file, 1).last
last_commit = CommitDecorator.decorate(last_commit)
{
file_name: content.name,
@ -45,10 +45,10 @@ class RefsController < ProjectResourceController
def define_tree_vars
params[:path] = nil if params[:path].blank?
@repo = project.repo
@commit = project.commit(@ref)
@repo = project.repository
@commit = @repo.commit(@ref)
@commit = CommitDecorator.decorate(@commit)
@tree = Tree.new(@commit.tree, project, @ref, params[:path])
@tree = Tree.new(@commit.tree, @ref, params[:path])
@tree = TreeDecorator.new(@tree)
@hex_path = Digest::SHA1.hexdigest(params[:path] || "")

View file

@ -5,19 +5,19 @@ class RepositoriesController < ProjectResourceController
before_filter :require_non_empty_project
def show
@activities = @project.commits_with_refs(20)
@activities = @repository.commits_with_refs(20)
end
def branches
@branches = @project.branches
@branches = @repository.branches
end
def tags
@tags = @project.tags
@tags = @repository.tags
end
def stats
@stats = Gitlab::GitStats.new(@project.repo, @project.root_ref)
@stats = Gitlab::GitStats.new(@repository.raw, @repository.root_ref)
@graph = @stats.graph
end
@ -27,7 +27,7 @@ class RepositoriesController < ProjectResourceController
end
file_path = @project.archive_repo(params[:ref])
file_path = @repository.archive_repo(params[:ref])
if file_path
# Send file to user