BigW Consortium Gitlab

projects_controller.rb 837 Bytes
Newer Older
1 2
class Explore::ProjectsController < ApplicationController
  skip_before_filter :authenticate_user!,
Ciro Santilli committed
3
                     :reject_blocked
4 5 6 7 8 9 10 11 12 13 14 15 16 17

  layout 'explore'

  def index
    @projects = ProjectsFinder.new.execute(current_user)
    @projects = @projects.search(params[:search]) if params[:search].present?
    @projects = @projects.sort(@sort = params[:sort])
    @projects = @projects.includes(:namespace).page(params[:page]).per(20)
  end

  def trending
    @trending_projects = TrendingProjectsFinder.new.execute(current_user)
    @trending_projects = @trending_projects.page(params[:page]).per(10)
  end
18 19 20

  def starred
    @starred_projects = ProjectsFinder.new.execute(current_user)
21
    @starred_projects = @starred_projects.reorder('star_count DESC')
22 23
    @starred_projects = @starred_projects.page(params[:page]).per(10)
  end
24
end