From 2a29482a291a32a6337481902f94e9f660be3e3e Mon Sep 17 00:00:00 2001
From: Maximilien Bausson <25268481+MBausson@users.noreply.github.com>
Date: Wed, 6 Nov 2024 12:07:04 +0100
Subject: [PATCH] Replace kaminari by pagy (#189)
---
Gemfile | 3 +-
Gemfile.lock | 6 +-
app/assets/stylesheets/application.scss | 4 +
app/controllers/application_controller.rb | 1 +
app/controllers/cables_controller.rb | 4 +-
.../changelog_entries_controller.rb | 3 +-
app/controllers/connections_controller.rb | 4 +-
app/controllers/modeles_controller.rb | 1 +
app/controllers/servers_controller.rb | 3 +-
app/helpers/application_helper.rb | 2 +
app/views/cables/index.html.erb | 2 +-
app/views/changelog_entries/index.html.erb | 68 +++---
app/views/connections/index.html.erb | 2 +-
app/views/servers/index.html.erb | 112 ++++-----
config/initializers/pagy.rb | 214 ++++++++++++++++++
15 files changed, 333 insertions(+), 96 deletions(-)
create mode 100644 config/initializers/pagy.rb
diff --git a/Gemfile b/Gemfile
index 4cfe47eff..21c865ebc 100644
--- a/Gemfile
+++ b/Gemfile
@@ -24,7 +24,8 @@ gem "simple_token_authentication", "~> 1.0"
gem "datagrid"
gem "faraday"
-gem "kaminari"
+gem "kaminari" # TODO: Remove when removing datagrid
+gem "pagy"
gem "pg"
gem "virtus"
diff --git a/Gemfile.lock b/Gemfile.lock
index 9e9568ea2..418203029 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -338,8 +338,9 @@ GEM
validate_url
webfinger (~> 2.0)
orm_adapter (0.5.0)
- parallel (1.26.3)
- parser (3.3.5.0)
+ pagy (9.1.1)
+ parallel (1.24.0)
+ parser (3.3.1.0)
ast (~> 2.4.1)
racc
passenger (6.0.23)
@@ -630,6 +631,7 @@ DEPENDENCIES
omniauth (~> 2.1.0)
omniauth-rails_csrf_protection
omniauth_openid_connect (~> 0.7.0)
+ pagy
passenger
pg
puma
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index ca01b41b8..54c97222b 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -766,6 +766,10 @@ body {
max-width: 100px;
}
+ nav.pagy-bootstrap.nav .pagination {
+ margin-bottom: 0;
+ }
+
/* Tom-Select */
/* Fix for dark mode */
.ts-dropdown, .ts-control, .ts-control input {
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index ef2a2d76d..de985dfa2 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -3,6 +3,7 @@
class ApplicationController < ActionController::Base
include ChangelogContextApplication
include Localization
+ include Pagy::Backend
acts_as_token_authentication_handler_for User
diff --git a/app/controllers/cables_controller.rb b/app/controllers/cables_controller.rb
index 56ffe4e4b..d9326199c 100644
--- a/app/controllers/cables_controller.rb
+++ b/app/controllers/cables_controller.rb
@@ -4,8 +4,8 @@ class CablesController < ApplicationController
before_action :set_cable, only: [:destroy]
def index
- @cables = sorted Cable.includes(:connections, connections: [:port])
- .order(created_at: :desc).page(params[:page]).per(100)
+ @cables = sorted(Cable.includes(:connections, connections: [:port]).order(created_at: :desc))
+ @pagy, @cables = pagy(@cables)
end
def destroy
diff --git a/app/controllers/changelog_entries_controller.rb b/app/controllers/changelog_entries_controller.rb
index 4acca6da3..91f749f94 100644
--- a/app/controllers/changelog_entries_controller.rb
+++ b/app/controllers/changelog_entries_controller.rb
@@ -1,6 +1,7 @@
class ChangelogEntriesController < ApplicationController
def index
- @changelog_entries = sorted changelog_scope.order(created_at: :desc).page(params[:page]).per(per_page)
+ @changelog_entries = sorted(changelog_scope.includes(:author, :object).order(created_at: :desc))
+ @pagy, @changelog_entries = pagy(@changelog_entries)
end
def show
diff --git a/app/controllers/connections_controller.rb b/app/controllers/connections_controller.rb
index 663b31adf..73b535025 100644
--- a/app/controllers/connections_controller.rb
+++ b/app/controllers/connections_controller.rb
@@ -2,8 +2,8 @@
class ConnectionsController < ApplicationController
def index
- @connections = sorted Connection.includes(:port, :card, :server, :card_type, :port_type, cable: :connections)
- .order(created_at: :desc).page(params[:page]).per(100)
+ @connections = sorted Connection.includes(:port, :card, :server, :card_type, :port_type, cable: :connections).order(created_at: :desc)
+ @pagy, @connections = pagy(@connections)
end
def edit
diff --git a/app/controllers/modeles_controller.rb b/app/controllers/modeles_controller.rb
index 891bbbb11..433bdedd2 100644
--- a/app/controllers/modeles_controller.rb
+++ b/app/controllers/modeles_controller.rb
@@ -8,6 +8,7 @@ class ModelesController < ApplicationController
def index
@filter = ProcessorFilter.new(Modele.includes(:category, :enclosures).order(:name), params)
@modeles = @filter.results
+
@types = @modeles.group_by { |m| m.category.name }.sort_by { |categorie, modeles| categorie.to_s }
end
diff --git a/app/controllers/servers_controller.rb b/app/controllers/servers_controller.rb
index 9acba99cf..3dbd594b6 100644
--- a/app/controllers/servers_controller.rb
+++ b/app/controllers/servers_controller.rb
@@ -10,7 +10,8 @@ def index
.references(:room, :islet, :bay, modele: :category)
.order(:name)
@filter = ProcessorFilter.new(@servers, params)
- @servers = @filter.results
+
+ @pagy, @servers = pagy(@filter.results)
@search_params = search_params
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ec6491259..333b58d3c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
module ApplicationHelper
+ include Pagy::Frontend
+
def accepted_format_for_attachment(model_klass, attribute_name)
validator = model_klass.validators_on(attribute_name.to_sym).find do |v|
v.is_a?(ActiveStorageValidations::ContentTypeValidator)
diff --git a/app/views/cables/index.html.erb b/app/views/cables/index.html.erb
index b9bb659ed..d25a6f5d8 100644
--- a/app/views/cables/index.html.erb
+++ b/app/views/cables/index.html.erb
@@ -51,5 +51,5 @@
<% end %>
<% end %>
- <%= paginate @cables %>
+ <%== pagy_bootstrap_nav @pagy %>
diff --git a/app/views/changelog_entries/index.html.erb b/app/views/changelog_entries/index.html.erb
index 910238623..5968bc2cd 100644
--- a/app/views/changelog_entries/index.html.erb
+++ b/app/views/changelog_entries/index.html.erb
@@ -10,47 +10,51 @@
<%= turbo_frame_tag "changelog-entries" do %>
- <%= render List::DataTableComponent.new(decorate(@changelog_entries)) do |table| %>
- <% table.with_column("", style: "min-width: 20px; width: 20px") do |changelog_entry| %>
- <%= link_to changelog_entry_path(changelog_entry), class: "btn btn-primary", target: :_top do %>
-
">
-
<%= t("action.show") %>
+
+ <%= render List::DataTableComponent.new(decorate(@changelog_entries)) do |table| %>
+ <% table.with_column("", style: "min-width: 20px; width: 20px") do |changelog_entry| %>
+ <%= link_to changelog_entry_path(changelog_entry), class: "btn btn-primary", target: :_top do %>
+
">
+
<%= t("action.show") %>
+ <% end %>
<% end %>
- <% end %>
- <% table.with_column(ChangelogEntry.human_attribute_name(:action), sort_by: :action) do |changelog_entry| %>
- <%= render changelog_entry.action_label_to_component %>
- <% end %>
+ <% table.with_column(ChangelogEntry.human_attribute_name(:action), sort_by: :action) do |changelog_entry| %>
+ <%= render changelog_entry.action_label_to_component %>
+ <% end %>
- <% table.with_column(ChangelogEntry.human_attribute_name(:author), sort_by: :author_id) do |changelog_entry| %>
- <%= link_to_if changelog_entry.author_id?, changelog_entry.author_display_name, changelog_entry.author, target: :_top %>
- <% end %>
+ <% table.with_column(ChangelogEntry.human_attribute_name(:author), sort_by: :author_id) do |changelog_entry| %>
+ <%= link_to_if changelog_entry.author_id?, changelog_entry.author_display_name, changelog_entry.author, target: :_top %>
+ <% end %>
- <% table.with_column(ChangelogEntry.human_attribute_name(:object), sort_by: :object_id) do |changelog_entry| %>
- <% begin %>
- <%= link_to changelog_entry.object_display_name, changelog_entry.object, target: :_top %>
- <% rescue NoMethodError %>
- <%= changelog_entry.object_display_name %>
+ <% table.with_column(ChangelogEntry.human_attribute_name(:object), sort_by: :object_id) do |changelog_entry| %>
+ <% begin %>
+ <%= link_to changelog_entry.object_display_name, changelog_entry.object, target: :_top %>
+ <% rescue NoMethodError %>
+ <%= changelog_entry.object_display_name %>
+ <% end %>
<% end %>
- <% end %>
- <% table.with_column(ChangelogEntry.human_attribute_name(:attributes)) do |changelog_entry| %>
-
-
- <%= sanitize changelog_entry.split_diff.left %>
+ <% table.with_column(ChangelogEntry.human_attribute_name(:attributes)) do |changelog_entry| %>
+
+
+ <%= sanitize changelog_entry.split_diff.left %>
+
+
+ <%= sanitize changelog_entry.split_diff.right %>
+
-
- <%= sanitize changelog_entry.split_diff.right %>
-
-
- <% end %>
+ <% end %>
- <% table.with_column(t("label_date"), sort_by: :created_at) do |changelog_entry| %>
- <%= l changelog_entry.created_at %>
+ <% table.with_column(t("label_date"), sort_by: :created_at) do |changelog_entry| %>
+ <%= l changelog_entry.created_at %>
+ <% end %>
<% end %>
- <% end %>
- <%= paginate @changelog_entries %>
+ <% if @pagy.pages > 1 %>
+ <%== pagy_bootstrap_nav(@pagy) %>
+ <% end %>
+
<% end %>
diff --git a/app/views/connections/index.html.erb b/app/views/connections/index.html.erb
index 0a1712751..9563aa633 100644
--- a/app/views/connections/index.html.erb
+++ b/app/views/connections/index.html.erb
@@ -54,5 +54,5 @@
<% end %>
<% end %>
- <%= paginate @connections %>
+ <%== pagy_bootstrap_nav(@pagy) %>
diff --git a/app/views/servers/index.html.erb b/app/views/servers/index.html.erb
index 735d6c79b..06249e9d5 100644
--- a/app/views/servers/index.html.erb
+++ b/app/views/servers/index.html.erb
@@ -125,61 +125,67 @@
<% end %>
<%= turbo_frame_tag(dom_id(Server, :table), data: { turbo_action: :advance }) do %>
- <%= render List::DataTableComponent.new(@servers) do |table| %>
- <% table.with_column(Server.human_attribute_name(:name), sort_by: :name) do |server| %>
- <%= link_to server.name, server_path(server), class: "fw-bold", data: { turbo_frame: :_top } %>
- <% end %>
-
- <% table.with_column(Server.human_attribute_name(:numero), sort_by: :numero) do |server| %>
- <%= link_to server.numero, server_path(server), class: "fw-bold", data: { turbo_frame: :_top } %>
- <% end %>
-
- <% table.with_column(Server.human_attribute_name(:type), sort_by: :"categories.name") do |server| %>
- <%= link_to server.modele.category, category_path(server.modele.category),
- data: { turbo_frame: :_top } if server.modele.try(:category) %>
- <% end %>
-
- <% table.with_column(Server.human_attribute_name(:room), sort_by: :"rooms.name") do |server| %>
- <%= link_to server.room, room_path(server.room), data: { turbo_frame: :_top } if server.room %>
- <% end %>
-
- <% table.with_column(Islet.model_name.human, sort_by: :"islets.name") do |server| %>
- <%= link_to server.islet, islet_path(server.islet), data: { turbo_frame: :_top } if server.islet %>
- <% end %>
-
- <% table.with_column(Bay.model_name.human, sort_by: :"bays.id") do |server| %>
- <%= link_to server.bay, bay_path(server.bay), data: { turbo_frame: :_top } if server.bay %>
- <% end %>
-
- <% table.with_column(Server.human_attribute_name(:network_types)) do |server| %>
- <%= server.decorated.network_types_to_human %>
- <% end %>
-
- <% table.with_column(style: "min-width: 100px; width: 100px") do |server| %>
-
- <%= link_to duplicate_server_path(server), class: "btn btn-success", data: { turbo_frame: :_top } do %>
-
" aria-hidden="true"
- data-controller="tooltip"
- data-bs-placement="left">
-
<%= t("action.duplicate") %>
- <% end %>
- <%= link_to edit_server_path(server), class: "btn btn-info", data: { turbo_frame: :_top } do %>
-
" aria-hidden="true"
- data-controller="tooltip"
- data-bs-placement="left">
-
<%= t("action.edit") %>
- <% end %>
- <%= link_to server_path(server, @search_params),
- method: :delete,
- data: { turbo_frame: :_top, confirm: t("action.confirm") },
- class: "btn btn-danger" do %>
-
" aria-hidden="true"
+
+ <%= render List::DataTableComponent.new(@servers) do |table| %>
+ <% table.with_column(Server.human_attribute_name(:name), sort_by: :name) do |server| %>
+ <%= link_to server.name, server_path(server), class: "fw-bold", data: { turbo_frame: :_top } %>
+ <% end %>
+
+ <% table.with_column(Server.human_attribute_name(:numero), sort_by: :numero) do |server| %>
+ <%= link_to server.numero, server_path(server), class: "fw-bold", data: { turbo_frame: :_top } %>
+ <% end %>
+
+ <% table.with_column(Server.human_attribute_name(:type), sort_by: :"categories.name") do |server| %>
+ <%= link_to server.modele.category, category_path(server.modele.category),
+ data: { turbo_frame: :_top } if server.modele.try(:category) %>
+ <% end %>
+
+ <% table.with_column(Server.human_attribute_name(:room), sort_by: :"rooms.name") do |server| %>
+ <%= link_to server.room, room_path(server.room), data: { turbo_frame: :_top } if server.room %>
+ <% end %>
+
+ <% table.with_column(Islet.model_name.human, sort_by: :"islets.name") do |server| %>
+ <%= link_to server.islet, islet_path(server.islet), data: { turbo_frame: :_top } if server.islet %>
+ <% end %>
+
+ <% table.with_column(Bay.model_name.human, sort_by: :"bays.id") do |server| %>
+ <%= link_to server.bay, bay_path(server.bay), data: { turbo_frame: :_top } if server.bay %>
+ <% end %>
+
+ <% table.with_column(Server.human_attribute_name(:network_types)) do |server| %>
+ <%= server.decorated.network_types_to_human %>
+ <% end %>
+
+ <% table.with_column(style: "min-width: 100px; width: 100px") do |server| %>
+
+ <%= link_to duplicate_server_path(server), class: "btn btn-success", data: { turbo_frame: :_top } do %>
+ " aria-hidden="true"
+ data-controller="tooltip"
+ data-bs-placement="left">
+ <%= t("action.duplicate") %>
+ <% end %>
+ <%= link_to edit_server_path(server), class: "btn btn-info", data: { turbo_frame: :_top } do %>
+ " aria-hidden="true"
data-controller="tooltip"
data-bs-placement="left">
- <%= t("action.delete") %>
- <% end %>
-
+
<%= t("action.edit") %>
+ <% end %>
+ <%= link_to server_path(server, @search_params),
+ method: :delete,
+ data: { turbo_frame: :_top, confirm: t("action.confirm") },
+ class: "btn btn-danger" do %>
+
" aria-hidden="true"
+ data-controller="tooltip"
+ data-bs-placement="left">
+
<%= t("action.delete") %>
+ <% end %>
+
+ <% end %>
<% end %>
- <% end %>
+
+ <% if @pagy.pages > 1 %>
+ <%== pagy_bootstrap_nav(@pagy) %>
+ <% end %>
+
<% end %>
diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb
new file mode 100644
index 000000000..8bf1e794b
--- /dev/null
+++ b/config/initializers/pagy.rb
@@ -0,0 +1,214 @@
+# frozen_string_literal: true
+
+# Pagy initializer file (9.1.0)
+# Customize only what you really need and notice that the core Pagy works also without any of the following lines.
+# Should you just cherry pick part of this file, please maintain the require-order of the extras
+
+# Pagy Variables
+# See https://ddnexus.github.io/pagy/docs/api/pagy#variables
+# You can set any pagy variable as a Pagy::DEFAULT. They can also be overridden per instance by just passing them to
+# Pagy.new|Pagy::Countless.new|Pagy::Calendar::*.new or any of the #pagy* controller methods
+# Here are the few that make more sense as DEFAULTs:
+# Pagy::DEFAULT[:limit] = 20 # default
+# Pagy::DEFAULT[:size] = 7 # default
+# Pagy::DEFAULT[:ends] = true # default
+# Pagy::DEFAULT[:page_param] = :page # default
+# Pagy::DEFAULT[:count_args] = [] # example for non AR ORMs
+# Pagy::DEFAULT[:max_pages] = 3000 # example
+
+# Extras
+# See https://ddnexus.github.io/pagy/categories/extra
+
+# Legacy Compatibility Extras
+
+# Size extra: Enable the Array type for the `:size` variable (e.g. `size: [1,4,4,1]`)
+# See https://ddnexus.github.io/pagy/docs/extras/size
+# require 'pagy/extras/size' # must be required before the other extras
+
+# Backend Extras
+
+# Arel extra: For better performance utilizing grouped ActiveRecord collections:
+# See: https://ddnexus.github.io/pagy/docs/extras/arel
+# require 'pagy/extras/arel'
+
+# Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding
+# See https://ddnexus.github.io/pagy/docs/extras/array
+# require 'pagy/extras/array'
+
+# Calendar extra: Add pagination filtering by calendar time unit (year, quarter, month, week, day)
+# See https://ddnexus.github.io/pagy/docs/extras/calendar
+# require 'pagy/extras/calendar'
+# Default for each calendar unit class in IRB:
+# >> Pagy::Calendar::Year::DEFAULT
+# >> Pagy::Calendar::Quarter::DEFAULT
+# >> Pagy::Calendar::Month::DEFAULT
+# >> Pagy::Calendar::Week::DEFAULT
+# >> Pagy::Calendar::Day::DEFAULT
+#
+# Uncomment the following lines, if you need calendar localization without using the I18n extra
+# module LocalizePagyCalendar
+# def localize(time, opts)
+# ::I18n.l(time, **opts)
+# end
+# end
+# Pagy::Calendar.prepend LocalizePagyCalendar
+
+# Countless extra: Paginate without any count, saving one query per rendering
+# See https://ddnexus.github.io/pagy/docs/extras/countless
+# require 'pagy/extras/countless'
+# Pagy::DEFAULT[:countless_minimal] = false # default (eager loading)
+
+# Elasticsearch Rails extra: Paginate `ElasticsearchRails::Results` objects
+# See https://ddnexus.github.io/pagy/docs/extras/elasticsearch_rails
+# Default :pagy_search method: change only if you use also
+# the searchkick or meilisearch extra that defines the same
+# Pagy::DEFAULT[:elasticsearch_rails_pagy_search] = :pagy_search
+# Default original :search method called internally to do the actual search
+# Pagy::DEFAULT[:elasticsearch_rails_search] = :search
+# require 'pagy/extras/elasticsearch_rails'
+
+# Headers extra: http response headers (and other helpers) useful for API pagination
+# See https://ddnexus.github.io/pagy/docs/extras/headers
+# require 'pagy/extras/headers'
+# Pagy::DEFAULT[:headers] = { page: 'Current-Page',
+# limit: 'Page-Items',
+# count: 'Total-Count',
+# pages: 'Total-Pages' } # default
+
+# Keyset extra: Paginate with the Pagy keyset pagination technique
+# See https://ddnexus.github.io/pagy/docs/extras/keyset
+# require 'pagy/extras/keyset'
+
+# Meilisearch extra: Paginate `Meilisearch` result objects
+# See https://ddnexus.github.io/pagy/docs/extras/meilisearch
+# Default :pagy_search method: change only if you use also
+# the elasticsearch_rails or searchkick extra that define the same method
+# Pagy::DEFAULT[:meilisearch_pagy_search] = :pagy_search
+# Default original :search method called internally to do the actual search
+# Pagy::DEFAULT[:meilisearch_search] = :ms_search
+# require 'pagy/extras/meilisearch'
+
+# Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
+# See https://ddnexus.github.io/pagy/docs/extras/metadata
+# you must require the JS Tools internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
+# require 'pagy/extras/js_tools'
+# require 'pagy/extras/metadata'
+# For performance reasons, you should explicitly set ONLY the metadata you use in the frontend
+# Pagy::DEFAULT[:metadata] = %i[scaffold_url page prev next last] # example
+
+# Searchkick extra: Paginate `Searchkick::Results` objects
+# See https://ddnexus.github.io/pagy/docs/extras/searchkick
+# Default :pagy_search method: change only if you use also
+# the elasticsearch_rails or meilisearch extra that defines the same
+# Pagy::DEFAULT[:searchkick_pagy_search] = :pagy_search
+# Default original :search method called internally to do the actual search
+# Pagy::DEFAULT[:searchkick_search] = :search
+# require 'pagy/extras/searchkick'
+# uncomment if you are going to use Searchkick.pagy_search
+# Searchkick.extend Pagy::Searchkick
+
+# Frontend Extras
+
+# Bootstrap extra: Add nav, nav_js and combo_nav_js helpers and templates for Bootstrap pagination
+# See https://ddnexus.github.io/pagy/docs/extras/bootstrap
+require "pagy/extras/bootstrap"
+
+# Bulma extra: Add nav, nav_js and combo_nav_js helpers and templates for Bulma pagination
+# See https://ddnexus.github.io/pagy/docs/extras/bulma
+# require 'pagy/extras/bulma'
+
+# Pagy extra: Add the pagy styled versions of the javascript-powered navs
+# and a few other components to the Pagy::Frontend module.
+# See https://ddnexus.github.io/pagy/docs/extras/pagy
+# require 'pagy/extras/pagy'
+
+# Multi size var used by the *_nav_js helpers
+# See https://ddnexus.github.io/pagy/docs/extras/pagy#steps
+# Pagy::DEFAULT[:steps] = { 0 => 5, 540 => 7, 720 => 9 } # example
+
+# Feature Extras
+
+# Gearbox extra: Automatically change the limit per page depending on the page number
+# See https://ddnexus.github.io/pagy/docs/extras/gearbox
+# require 'pagy/extras/gearbox'
+# set to false only if you want to make :gearbox_extra an opt-in variable
+# Pagy::DEFAULT[:gearbox_extra] = false # default true
+# Pagy::DEFAULT[:gearbox_limit] = [15, 30, 60, 100] # default
+
+# Limit extra: Allow the client to request a custom limit per page with an optional selector UI
+# See https://ddnexus.github.io/pagy/docs/extras/limit
+# require 'pagy/extras/limit'
+# set to false only if you want to make :limit_extra an opt-in variable
+# Pagy::DEFAULT[:limit_extra] = false # default true
+# Pagy::DEFAULT[:limit_param] = :limit # default
+# Pagy::DEFAULT[:limit_max] = 100 # default
+
+# Overflow extra: Allow for easy handling of overflowing pages
+# See https://ddnexus.github.io/pagy/docs/extras/overflow
+# require 'pagy/extras/overflow'
+# Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception)
+
+# Trim extra: Remove the page=1 param from links
+# See https://ddnexus.github.io/pagy/docs/extras/trim
+# require 'pagy/extras/trim'
+# set to false only if you want to make :trim_extra an opt-in variable
+# Pagy::DEFAULT[:trim_extra] = false # default true
+
+# Standalone extra: Use pagy in non Rack environment/gem
+# See https://ddnexus.github.io/pagy/docs/extras/standalone
+# require 'pagy/extras/standalone'
+# Pagy::DEFAULT[:url] = 'http://www.example.com/subdir' # optional default
+
+# Jsonapi extra: Implements JSON:API specifications
+# See https://ddnexus.github.io/pagy/docs/extras/jsonapi
+# require 'pagy/extras/jsonapi' # must be required after the other extras
+# set to false only if you want to make :jsonapi an opt-in variable
+# Pagy::DEFAULT[:jsonapi] = false # default true
+
+# Rails
+# Enable the .js file required by the helpers that use javascript
+# (pagy*_nav_js, pagy*_combo_nav_js, and pagy_limit_selector_js)
+# See https://ddnexus.github.io/pagy/docs/api/javascript
+
+# With the asset pipeline
+# Sprockets need to look into the pagy javascripts dir, so add it to the assets paths
+# Rails.application.config.assets.paths << Pagy.root.join('javascripts')
+
+# I18n
+
+# Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem
+# See https://ddnexus.github.io/pagy/docs/api/i18n
+# Notice: No need to configure anything in this section if your app uses only "en"
+# or if you use the i18n extra below
+#
+# Examples:
+# load the "de" built-in locale:
+# Pagy::I18n.load(locale: 'de')
+#
+# load the "de" locale defined in the custom file at :filepath:
+# Pagy::I18n.load(locale: 'de', filepath: 'path/to/pagy-de.yml')
+#
+# load the "de", "en" and "es" built-in locales:
+# (the first passed :locale will be used also as the default_locale)
+# Pagy::I18n.load({ locale: 'de' },
+# { locale: 'en' },
+# { locale: 'es' })
+#
+# load the "en" built-in locale, a custom "es" locale,
+# and a totally custom locale complete with a custom :pluralize proc:
+# (the first passed :locale will be used also as the default_locale)
+# Pagy::I18n.load({ locale: 'en' },
+# { locale: 'es', filepath: 'path/to/pagy-es.yml' },
+# { locale: 'xyz', # not built-in
+# filepath: 'path/to/pagy-xyz.yml',
+# pluralize: lambda{ |count| ... } )
+
+# I18n extra: uses the standard i18n gem which is ~18x slower using ~10x more memory
+# than the default pagy internal i18n (see above)
+# See https://ddnexus.github.io/pagy/docs/extras/i18n
+# require 'pagy/extras/i18n'
+
+Pagy::DEFAULT[:limit] = 50
+
+# When you are done setting your own default freeze it, so it will not get changed accidentally
+Pagy::DEFAULT.freeze