Maintenance: Moved pagination controller concern to the proper place.

This commit is contained in:
Dominik Klein 2021-09-07 12:34:10 +02:00 committed by Thorsten Eckel
parent 2a429af5af
commit ae4f400713
9 changed files with 10 additions and 10 deletions

View file

@ -3,7 +3,7 @@
module ApplicationController::RendersModels module ApplicationController::RendersModels
extend ActiveSupport::Concern extend ActiveSupport::Concern
include ApplicationController::Paginates include CanPaginate
private private

View file

@ -1,6 +1,6 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
module ApplicationController::Paginates module CanPaginate
extend ActiveSupport::Concern extend ActiveSupport::Concern
def paginate_with(max: nil, default: nil) def paginate_with(max: nil, default: nil)
@ -11,6 +11,6 @@ module ApplicationController::Paginates
private private
def pagination def pagination
@pagination ||= ::ApplicationController::Paginates::Pagination.new(params, max: @paginate_max, default: @paginate_default) @pagination ||= CanPaginate::Pagination.new(params, max: @paginate_max, default: @paginate_default)
end end
end end

View file

@ -1,6 +1,6 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
class ApplicationController::Paginates::Pagination class CanPaginate::Pagination
def initialize(params, default: nil, max: nil) def initialize(params, default: nil, max: nil)
@params = params @params = params

View file

@ -6,7 +6,7 @@ class KnowledgeBase::SearchController < ApplicationController
include KnowledgeBaseHelper include KnowledgeBaseHelper
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
include ApplicationController::Paginates include CanPaginate
# POST /api/v1/knowledge_bases/search # POST /api/v1/knowledge_bases/search
# knowledge_base_id, locale, flavor, index, page, per_page, limit, include_locale # knowledge_base_id, locale, flavor, index, page, per_page, limit, include_locale

View file

@ -4,7 +4,7 @@ class OrganizationsController < ApplicationController
prepend_before_action -> { authorize! }, except: %i[index show] prepend_before_action -> { authorize! }, except: %i[index show]
prepend_before_action { authentication_check } prepend_before_action { authentication_check }
include ApplicationController::Paginates include CanPaginate
=begin =begin

View file

@ -5,7 +5,7 @@ class TicketsController < ApplicationController
include ClonesTicketArticleAttachments include ClonesTicketArticleAttachments
include ChecksUserAttributesByCurrentUserPermission include ChecksUserAttributesByCurrentUserPermission
include TicketStats include TicketStats
include ApplicationController::Paginates include CanPaginate
prepend_before_action -> { authorize! }, only: %i[create selector import_example import_start ticket_customer ticket_history ticket_related ticket_recent ticket_merge ticket_split] prepend_before_action -> { authorize! }, only: %i[create selector import_example import_start ticket_customer ticket_history ticket_related ticket_recent ticket_merge ticket_split]
prepend_before_action :authentication_check prepend_before_action :authentication_check

View file

@ -2,7 +2,7 @@
class UsersController < ApplicationController class UsersController < ApplicationController
include ChecksUserAttributesByCurrentUserPermission include ChecksUserAttributesByCurrentUserPermission
include ApplicationController::Paginates include CanPaginate
prepend_before_action -> { authorize! }, only: %i[import_example import_start search history unlock] prepend_before_action -> { authorize! }, only: %i[import_example import_start search history unlock]
prepend_before_action :authentication_check, except: %i[create password_reset_send password_reset_verify image email_verify email_verify_send] prepend_before_action :authentication_check, except: %i[create password_reset_send password_reset_verify image email_verify email_verify_send]

View file

@ -2,7 +2,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe ApplicationController::Paginates::Pagination do RSpec.describe CanPaginate::Pagination do
describe '#limit' do describe '#limit' do
it 'returns as set in params' do it 'returns as set in params' do
instance = described_class.new({ per_page: 123 }) instance = described_class.new({ per_page: 123 })

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
FactoryBot.define do FactoryBot.define do
factory :'application_controller/paginates/pagination', aliases: %i[pagination] do factory :'can_paginate/pagination', aliases: %i[pagination] do
params { {} } params { {} }
default { nil } default { nil }