2012-09-27 20:59:42 +02:00
|
|
|
class RepositoriesController < ProjectResourceController
|
2011-12-30 22:56:13 +02:00
|
|
|
# Authorize
|
|
|
|
before_filter :authorize_read_project!
|
2012-02-22 00:31:18 +02:00
|
|
|
before_filter :authorize_code_access!
|
2011-12-30 22:56:13 +02:00
|
|
|
before_filter :require_non_empty_project
|
|
|
|
|
|
|
|
def show
|
2012-01-04 08:17:41 +02:00
|
|
|
@activities = @project.commits_with_refs(20)
|
2011-12-30 22:56:13 +02:00
|
|
|
end
|
2011-12-31 13:12:10 +02:00
|
|
|
|
|
|
|
def branches
|
2012-09-26 13:38:14 -04:00
|
|
|
@branches = @project.branches
|
2011-12-31 13:12:10 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def tags
|
2012-09-26 13:38:14 -04:00
|
|
|
@tags = @project.tags
|
2011-12-31 13:12:10 +02:00
|
|
|
end
|
2012-02-08 01:00:49 +02:00
|
|
|
|
|
|
|
def archive
|
|
|
|
unless can?(current_user, :download_code, @project)
|
|
|
|
render_404 and return
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-06-13 09:03:53 +03: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 01:00:49 +02:00
|
|
|
end
|
2011-12-30 22:56:13 +02:00
|
|
|
end
|