repositories_controller.rb 638 Bytes
Newer Older
1
class RepositoriesController < ProjectResourceController
2 3
  # Authorize
  before_filter :authorize_read_project!
4
  before_filter :authorize_code_access!
5 6 7
  before_filter :require_non_empty_project

  def show
8
    @activities = @project.commits_with_refs(20)
9
  end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
10 11

  def branches
12
    @branches = @project.branches
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
13 14 15
  end

  def tags
16
    @tags = @project.tags
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
17
  end
18 19 20 21 22 23 24

  def archive
    unless can?(current_user, :download_code, @project)
      render_404 and return 
    end


25 26 27 28 29 30 31 32
    file_path = @project.archive_repo(params[:ref])

    if file_path
      # Send file to user
      send_file file_path
    else
      render_404
    end
33
  end
34
end