2011-12-30 21:56:13 +01:00
|
|
|
class RepositoriesController < ApplicationController
|
|
|
|
before_filter :project
|
|
|
|
|
|
|
|
# Authorize
|
|
|
|
before_filter :add_project_abilities
|
|
|
|
before_filter :authorize_read_project!
|
2012-02-21 23:31:18 +01:00
|
|
|
before_filter :authorize_code_access!
|
2011-12-30 21:56:13 +01:00
|
|
|
before_filter :require_non_empty_project
|
2012-02-20 07:39:03 +01:00
|
|
|
before_filter :render_full_content
|
2011-12-30 21:56:13 +01:00
|
|
|
|
|
|
|
layout "project"
|
|
|
|
|
|
|
|
def show
|
2012-01-04 07:17:41 +01:00
|
|
|
@activities = @project.commits_with_refs(20)
|
2011-12-30 21:56:13 +01:00
|
|
|
end
|
2011-12-31 12:12:10 +01:00
|
|
|
|
|
|
|
def branches
|
|
|
|
@branches = @project.repo.heads.sort_by(&:name)
|
|
|
|
end
|
|
|
|
|
|
|
|
def tags
|
|
|
|
@tags = @project.repo.tags.sort_by(&:name).reverse
|
|
|
|
end
|
2012-02-08 00:00:49 +01:00
|
|
|
|
|
|
|
def archive
|
|
|
|
unless can?(current_user, :download_code, @project)
|
|
|
|
render_404 and return
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-06-13 08:03:53 +02:00
|
|
|
file_path = @project.archive_repo(params[:ref])
|
|
|
|
|
|
|
|
if file_path
|
|
|
|
# Send file to user
|
|
|
|
send_file file_path
|
|
|
|
else
|
|
|
|
render_404
|
|
|
|
end
|
2012-02-08 00:00:49 +01:00
|
|
|
end
|
2011-12-30 21:56:13 +01:00
|
|
|
end
|