projects_controller.rb 834 Bytes
Newer Older
1 2
class Public::ProjectsController < ApplicationController
  skip_before_filter :authenticate_user!,
3 4
                     :reject_blocked, :set_current_user_for_observers,
                     :add_abilities
5 6 7 8

  layout 'public'

  def index
9
    @projects = Project.public_only
10
    @projects = @projects.search(params[:search]) if params[:search].present?
11
    @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20)
12
  end
13 14 15 16 17 18

  def show
    @project = Project.public_only.find_with_namespace(params[:id])
    render_404 and return unless @project

    @repository = @project.repository
19 20
    unless @project.empty_repo?
      @recent_tags = @repository.tags.first(10)
21

22 23 24
      @commit = @repository.commit(params[:ref])
      @tree = Tree.new(@repository, @commit.id)
    end
25
  end
26
end