Welcome to mirror list, hosted at ThFree Co, Russian Federation.

projects_controller.rb « explore « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2689bf4f1ec8f52be662a4286c310fdef026cea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Explore::ProjectsController < Explore::ApplicationController
  def index
    @projects = ProjectsFinder.new.execute(current_user)
    @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?
    @projects = @projects.non_archived
    @projects = @projects.search(params[:search]) if params[:search].present?
    @projects = @projects.sort(@sort = params[:sort])
    @projects = @projects.includes(:namespace).page(params[:page]).per(PER_PAGE)
  end

  def trending
    @projects = TrendingProjectsFinder.new.execute(current_user)
    @projects = @projects.non_archived
    @projects = @projects.page(params[:page]).per(PER_PAGE)
  end

  def starred
    @projects = ProjectsFinder.new.execute(current_user)
    @projects = @projects.reorder('star_count DESC')
    @projects = @projects.page(params[:page]).per(PER_PAGE)
  end
end