debian-mirror-gitlab/app/controllers/explore/projects_controller.rb

25 lines
1.1 KiB
Ruby
Raw Normal View History

2015-09-11 14:41:01 +05:30
class Explore::ProjectsController < Explore::ApplicationController
2014-09-02 18:07:02 +05:30
def index
@projects = ProjectsFinder.new.execute(current_user)
2015-04-26 12:48:37 +05:30
@tags = @projects.tags_on(:tags)
@projects = @projects.tagged_with(params[:tag]) if params[:tag].present?
@projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present?
2015-09-25 12:07:36 +05:30
@projects = @projects.non_archived
2014-09-02 18:07:02 +05:30
@projects = @projects.search(params[:search]) if params[:search].present?
@projects = @projects.sort(@sort = params[:sort])
2015-04-26 12:48:37 +05:30
@projects = @projects.includes(:namespace).page(params[:page]).per(PER_PAGE)
2014-09-02 18:07:02 +05:30
end
def trending
@trending_projects = TrendingProjectsFinder.new.execute(current_user)
2015-09-25 12:07:36 +05:30
@trending_projects = @trending_projects.non_archived
2015-04-26 12:48:37 +05:30
@trending_projects = @trending_projects.page(params[:page]).per(PER_PAGE)
2014-09-02 18:07:02 +05:30
end
def starred
@starred_projects = ProjectsFinder.new.execute(current_user)
2015-04-26 12:48:37 +05:30
@starred_projects = @starred_projects.reorder('star_count DESC')
@starred_projects = @starred_projects.page(params[:page]).per(PER_PAGE)
2014-09-02 18:07:02 +05:30
end
end