diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-03-19 17:37:54 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-03-19 17:37:54 -0400 |
commit | 085538c2bd817fc083ee9e42c9fdd7f74fc48ecb (patch) | |
tree | d7beb73fab81ab9bf4c1c95fe8dd0e7a0ed29c36 | |
parent | 3f22a92f4a561543c2249786b695d0c65120455b (diff) | |
download | gitlab-ce-085538c2bd817fc083ee9e42c9fdd7f74fc48ecb.tar.gz |
Use the configured Kaminari "per page" defaultrs-use-kaminari-default
28 files changed, 34 insertions, 37 deletions
diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 668396a0f20..b2b817e64f9 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -5,12 +5,12 @@ class Admin::GroupsController < Admin::ApplicationController @groups = Group.all @groups = @groups.sort(@sort = params[:sort]) @groups = @groups.search(params[:name]) if params[:name].present? - @groups = @groups.page(params[:page]).per(PER_PAGE) + @groups = @groups.page(params[:page]) end def show - @members = @group.members.order("access_level DESC").page(params[:members_page]).per(PER_PAGE) - @projects = @group.projects.page(params[:projects_page]).per(PER_PAGE) + @members = @group.members.order("access_level DESC").page(params[:members_page]) + @projects = @group.projects.page(params[:projects_page]) end def new diff --git a/app/controllers/admin/labels_controller.rb b/app/controllers/admin/labels_controller.rb index d79ce2b10fe..d496f08a598 100644 --- a/app/controllers/admin/labels_controller.rb +++ b/app/controllers/admin/labels_controller.rb @@ -2,7 +2,7 @@ class Admin::LabelsController < Admin::ApplicationController before_action :set_label, only: [:show, :edit, :update, :destroy] def index - @labels = Label.templates.page(params[:page]).per(PER_PAGE) + @labels = Label.templates.page(params[:page]) end def show diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index ae1de06b983..4a6edafdeec 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -12,15 +12,15 @@ class Admin::ProjectsController < Admin::ApplicationController @projects = @projects.non_archived unless params[:with_archived].present? @projects = @projects.search(params[:name]) if params[:name].present? @projects = @projects.sort(@sort = params[:sort]) - @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(PER_PAGE) + @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]) end def show if @group - @group_members = @group.members.order("access_level DESC").page(params[:group_members_page]).per(PER_PAGE) + @group_members = @group.members.order("access_level DESC").page(params[:group_members_page]) end - @project_members = @project.project_members.page(params[:project_members_page]).per(PER_PAGE) + @project_members = @project.project_members.page(params[:project_members_page]) end def transfer diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1f55b18e0b1..de7d323907a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,8 +6,6 @@ class ApplicationController < ActionController::Base include GitlabRoutingHelper include PageLayoutHelper - PER_PAGE = 20 - before_action :authenticate_user_from_token! before_action :authenticate_user! before_action :validate_user_service_ticket! diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb index 77c8dafc012..81ba58ce49c 100644 --- a/app/controllers/autocomplete_controller.rb +++ b/app/controllers/autocomplete_controller.rb @@ -7,7 +7,7 @@ class AutocompleteController < ApplicationController @users = @users.search(params[:search]) if params[:search].present? @users = @users.active @users = @users.reorder(:name) - @users = @users.page(params[:page]).per(PER_PAGE) + @users = @users.page(params[:page]) if params[:search].blank? # Include current user if available to filter by "Me" diff --git a/app/controllers/concerns/global_milestones.rb b/app/controllers/concerns/global_milestones.rb index 3e4c0e63601..54ea1e454fc 100644 --- a/app/controllers/concerns/global_milestones.rb +++ b/app/controllers/concerns/global_milestones.rb @@ -6,7 +6,7 @@ module GlobalMilestones @milestones = MilestonesFinder.new.execute(@projects, params) @milestones = GlobalMilestone.build_collection(@milestones) @milestones = @milestones.sort_by { |x| x.due_date.nil? ? epoch : x.due_date } - @milestones = Kaminari.paginate_array(@milestones).page(params[:page]).per(ApplicationController::PER_PAGE) + @milestones = Kaminari.paginate_array(@milestones).page(params[:page]) end def milestone diff --git a/app/controllers/concerns/issues_action.rb b/app/controllers/concerns/issues_action.rb index ef8e74a4641..4feabc32b1c 100644 --- a/app/controllers/concerns/issues_action.rb +++ b/app/controllers/concerns/issues_action.rb @@ -3,7 +3,7 @@ module IssuesAction def issues @issues = get_issues_collection.non_archived - @issues = @issues.page(params[:page]).per(ApplicationController::PER_PAGE) + @issues = @issues.page(params[:page]) @issues = @issues.preload(:author, :project) @label = @issuable_finder.labels.first diff --git a/app/controllers/concerns/merge_requests_action.rb b/app/controllers/concerns/merge_requests_action.rb index 9c49596bd0b..06a6b065e7e 100644 --- a/app/controllers/concerns/merge_requests_action.rb +++ b/app/controllers/concerns/merge_requests_action.rb @@ -3,7 +3,7 @@ module MergeRequestsAction def merge_requests @merge_requests = get_merge_requests_collection.non_archived - @merge_requests = @merge_requests.page(params[:page]).per(ApplicationController::PER_PAGE) + @merge_requests = @merge_requests.page(params[:page]) @merge_requests = @merge_requests.preload(:author, :target_project) @label = @issuable_finder.labels.first diff --git a/app/controllers/dashboard/groups_controller.rb b/app/controllers/dashboard/groups_controller.rb index 3bc94ff2187..71ba6153021 100644 --- a/app/controllers/dashboard/groups_controller.rb +++ b/app/controllers/dashboard/groups_controller.rb @@ -1,5 +1,5 @@ class Dashboard::GroupsController < Dashboard::ApplicationController def index - @group_members = current_user.group_members.page(params[:page]).per(PER_PAGE) + @group_members = current_user.group_members.page(params[:page]) end end diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 0e8b63872ca..71acc244a91 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -8,7 +8,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController @projects = filter_projects(@projects) @projects = @projects.includes(:namespace) @projects = @projects.sort(@sort = params[:sort]) - @projects = @projects.page(params[:page]).per(PER_PAGE) + @projects = @projects.page(params[:page]) @last_push = current_user.recent_push @@ -32,7 +32,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController @projects = filter_projects(@projects) @projects = @projects.includes(:namespace, :forked_from_project, :tags) @projects = @projects.sort(@sort = params[:sort]) - @projects = @projects.page(params[:page]).per(PER_PAGE) + @projects = @projects.page(params[:page]) @last_push = current_user.recent_push @groups = [] diff --git a/app/controllers/dashboard/snippets_controller.rb b/app/controllers/dashboard/snippets_controller.rb index b3594d82530..bcfdbe14be9 100644 --- a/app/controllers/dashboard/snippets_controller.rb +++ b/app/controllers/dashboard/snippets_controller.rb @@ -6,6 +6,6 @@ class Dashboard::SnippetsController < Dashboard::ApplicationController user: current_user, scope: params[:scope] ) - @snippets = @snippets.page(params[:page]).per(PER_PAGE) + @snippets = @snippets.page(params[:page]) end end diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index be488483b09..5abf97342c3 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -2,7 +2,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController before_action :find_todos, only: [:index, :destroy, :destroy_all] def index - @todos = @todos.page(params[:page]).per(PER_PAGE) + @todos = @todos.page(params[:page]) end def destroy diff --git a/app/controllers/explore/groups_controller.rb b/app/controllers/explore/groups_controller.rb index a9bf4321f73..2580f15c432 100644 --- a/app/controllers/explore/groups_controller.rb +++ b/app/controllers/explore/groups_controller.rb @@ -3,6 +3,6 @@ class Explore::GroupsController < Explore::ApplicationController @groups = Group.order_id_desc @groups = @groups.search(params[:search]) if params[:search].present? @groups = @groups.sort(@sort = params[:sort]) - @groups = @groups.page(params[:page]).per(PER_PAGE) + @groups = @groups.page(params[:page]) end end diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb index 8271ca87436..88a0c18180b 100644 --- a/app/controllers/explore/projects_controller.rb +++ b/app/controllers/explore/projects_controller.rb @@ -8,7 +8,7 @@ class Explore::ProjectsController < Explore::ApplicationController @projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present? @projects = filter_projects(@projects) @projects = @projects.sort(@sort = params[:sort]) - @projects = @projects.includes(:namespace).page(params[:page]).per(PER_PAGE) + @projects = @projects.includes(:namespace).page(params[:page]) respond_to do |format| format.html @@ -23,7 +23,7 @@ class Explore::ProjectsController < Explore::ApplicationController def trending @projects = TrendingProjectsFinder.new.execute(current_user) @projects = filter_projects(@projects) - @projects = @projects.page(params[:page]).per(PER_PAGE) + @projects = @projects.page(params[:page]) respond_to do |format| format.html @@ -39,7 +39,7 @@ class Explore::ProjectsController < Explore::ApplicationController @projects = ProjectsFinder.new.execute(current_user) @projects = filter_projects(@projects) @projects = @projects.reorder('star_count DESC') - @projects = @projects.page(params[:page]).per(PER_PAGE) + @projects = @projects.page(params[:page]) respond_to do |format| format.html diff --git a/app/controllers/explore/snippets_controller.rb b/app/controllers/explore/snippets_controller.rb index b70ac51d06e..28760c3f84b 100644 --- a/app/controllers/explore/snippets_controller.rb +++ b/app/controllers/explore/snippets_controller.rb @@ -1,6 +1,6 @@ class Explore::SnippetsController < Explore::ApplicationController def index @snippets = SnippetsFinder.new.execute(current_user, filter: :all) - @snippets = @snippets.page(params[:page]).per(PER_PAGE) + @snippets = @snippets.page(params[:page]) end end diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 06c5c8be9a5..5f9844104b8 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -44,7 +44,7 @@ class GroupsController < Groups::ApplicationController @projects = @projects.includes(:namespace) @projects = filter_projects(@projects) @projects = @projects.sort(@sort = params[:sort]) - @projects = @projects.page(params[:page]).per(PER_PAGE) if params[:filter_projects].blank? + @projects = @projects.page(params[:page]) if params[:filter_projects].blank? @shared_projects = @group.shared_projects diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 32fca6b838e..9042d8e5f0d 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -34,8 +34,7 @@ class ProfilesController < Profiles::ApplicationController def audit_log @events = AuditEvent.where(entity_type: "User", entity_id: current_user.id). order("created_at DESC"). - page(params[:page]). - per(PER_PAGE) + page(params[:page]) end def update_username diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index 43ea717cbd2..c0a53734921 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -8,7 +8,7 @@ class Projects::BranchesController < Projects::ApplicationController def index @sort = params[:sort] || 'name' @branches = @repository.branches_sorted_by(@sort) - @branches = Kaminari.paginate_array(@branches).page(params[:page]).per(PER_PAGE) + @branches = Kaminari.paginate_array(@branches).page(params[:page]) @max_commits = @branches.reduce(0) do |memo, branch| diverging_commit_counts = repository.diverging_commit_counts(branch) diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index a1b8632df98..ade01c706a7 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -15,7 +15,7 @@ class Projects::ForksController < Projects::ApplicationController @sort = params[:sort] || 'id_desc' @forks = @forks.search(params[:filter_projects]) if params[:filter_projects].present? - @forks = @forks.order_by(@sort).page(params[:page]).per(PER_PAGE) + @forks = @forks.order_by(@sort).page(params[:page]) respond_to do |format| format.html diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 6603f28a082..fb8375116c6 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -33,7 +33,7 @@ class Projects::IssuesController < Projects::ApplicationController end end - @issues = @issues.page(params[:page]).per(PER_PAGE) + @issues = @issues.page(params[:page]) @label = @project.labels.find_by(title: params[:label_name]) respond_to do |format| diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb index 5f471d405f5..ff771ea6d9c 100644 --- a/app/controllers/projects/labels_controller.rb +++ b/app/controllers/projects/labels_controller.rb @@ -11,7 +11,7 @@ class Projects::LabelsController < Projects::ApplicationController respond_to :js, :html def index - @labels = @project.labels.page(params[:page]).per(PER_PAGE) + @labels = @project.labels.page(params[:page]) respond_to do |format| format.html diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 7248ede1699..99cb5981940 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -34,7 +34,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController end end - @merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE) + @merge_requests = @merge_requests.page(params[:page]) @merge_requests = @merge_requests.preload(:target_project) @label = @project.labels.find_by(title: params[:label_name]) diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb index 0998b191c07..b2e974eff17 100644 --- a/app/controllers/projects/milestones_controller.rb +++ b/app/controllers/projects/milestones_controller.rb @@ -22,7 +22,7 @@ class Projects::MilestonesController < Projects::ApplicationController respond_to do |format| format.html do - @milestones = @milestones.page(params[:page]).per(PER_PAGE) + @milestones = @milestones.page(params[:page]) end format.json do render json: @milestones diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb index 92b0caa2efb..b578b419a46 100644 --- a/app/controllers/projects/snippets_controller.rb +++ b/app/controllers/projects/snippets_controller.rb @@ -21,7 +21,7 @@ class Projects::SnippetsController < Projects::ApplicationController filter: :by_project, project: @project }) - @snippets = @snippets.page(params[:page]).per(PER_PAGE) + @snippets = @snippets.page(params[:page]) end def new diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb index e580487a2c6..46b242aa5ff 100644 --- a/app/controllers/projects/tags_controller.rb +++ b/app/controllers/projects/tags_controller.rb @@ -7,7 +7,7 @@ class Projects::TagsController < Projects::ApplicationController def index sorted = VersionSorter.rsort(@repository.tag_names) - @tags = Kaminari.paginate_array(sorted).page(params[:page]).per(PER_PAGE) + @tags = Kaminari.paginate_array(sorted).page(params[:page]) @releases = project.releases.where(tag: @tags) end diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index 88fccfed509..02ceb8f4334 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -7,7 +7,7 @@ class Projects::WikisController < Projects::ApplicationController before_action :load_project_wiki def pages - @wiki_pages = Kaminari.paginate_array(@project_wiki.pages).page(params[:page]).per(PER_PAGE) + @wiki_pages = Kaminari.paginate_array(@project_wiki.pages).page(params[:page]) end def show diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index c72df73af46..2daceed039b 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -25,7 +25,7 @@ class SnippetsController < ApplicationController filter: :by_user, user: @user, scope: params[:scope] }). - page(params[:page]).per(PER_PAGE) + page(params[:page]) render 'index' else diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e10c633690f..169bef670aa 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -100,7 +100,7 @@ class UsersController < ApplicationController def load_projects @projects = PersonalProjectsFinder.new(@user).execute(current_user) - .page(params[:page]).per(PER_PAGE) + .page(params[:page]) end def load_contributed_projects |