diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-10 15:01:38 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-14 13:53:42 +0200 |
commit | c1f9403e45e636651010929b6113add34f8e6a8a (patch) | |
tree | 1f4dba647c4de1f43b01082c71fd70884c7ec54e /app/controllers | |
parent | 21a6898b10ed75f6260e72467b9e1f839d48456c (diff) | |
download | gitlab-ce-c1f9403e45e636651010929b6113add34f8e6a8a.tar.gz |
Use Prev/Next pagination for exploring projectspagination-projects-explore
This changes the pagination of the "Explore" pages so they use a simpler
pagination system that only shows "Prev" and "Next" buttons. This
removes the need for getting the total number of rows to display, a
process that can easily take up to 2 seconds when browsing through a
large list of projects.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/27390
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/explore/projects_controller.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb index 741879dee35..762c6ebf3a3 100644 --- a/app/controllers/explore/projects_controller.rb +++ b/app/controllers/explore/projects_controller.rb @@ -6,7 +6,7 @@ class Explore::ProjectsController < Explore::ApplicationController def index params[:sort] ||= 'latest_activity_desc' @sort = params[:sort] - @projects = load_projects.page(params[:page]) + @projects = load_projects respond_to do |format| format.html @@ -21,7 +21,7 @@ class Explore::ProjectsController < Explore::ApplicationController def trending params[:trending] = true @sort = params[:sort] - @projects = load_projects.page(params[:page]) + @projects = load_projects respond_to do |format| format.html @@ -34,7 +34,7 @@ class Explore::ProjectsController < Explore::ApplicationController end def starred - @projects = load_projects.reorder('star_count DESC').page(params[:page]) + @projects = load_projects.reorder('star_count DESC') respond_to do |format| format.html @@ -50,6 +50,9 @@ class Explore::ProjectsController < Explore::ApplicationController def load_projects ProjectsFinder.new(current_user: current_user, params: params) - .execute.includes(:route, namespace: :route) + .execute + .includes(:route, namespace: :route) + .page(params[:page]) + .without_count end end |