gitlab-org--gitlab-foss/app/controllers/explore/projects_controller.rb
Ciro Santilli b66a152735 Factor abilities methods
in app controller, user model and services.
2014-10-19 11:12:39 +02:00

24 lines
835 B
Ruby

class Explore::ProjectsController < ApplicationController
skip_before_filter :authenticate_user!,
:reject_blocked
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
def starred
@starred_projects = ProjectsFinder.new.execute(current_user)
@starred_projects = @starred_projects.order('star_count DESC')
@starred_projects = @starred_projects.page(params[:page]).per(10)
end
end