|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | | -# Pagy initializer file (43.2.4) |
| 3 | +# Pagy initializer file (43.3.0) |
4 | 4 | # See https://ddnexus.github.io/pagy/resources/initializer/ |
5 | 5 |
|
6 | | - |
7 | | -# Pagy Variables |
8 | | -# See https://ddnexus.github.io/pagy/docs/api/pagy#variables |
9 | | -# You can set any pagy variable as a Pagy::DEFAULT. They can also be overridden per instance by just passing them to |
10 | | -# Pagy.new|Pagy::Countless.new|Pagy::Calendar::*.new or any of the #pagy* controller methods |
11 | | -# Here are the few that make more sense as DEFAULTs: |
12 | | -# Pagy::DEFAULT[:limit] = 20 # display 20 results per page to match UI expectations |
13 | | -# Pagy::DEFAULT[:size] = 7 # default |
14 | | -# Pagy::DEFAULT[:ends] = true # default |
15 | | -# Pagy::DEFAULT[:page_param] = :page # default |
16 | | -# Pagy::DEFAULT[:count_args] = [] # example for non AR ORMs |
17 | | -# Pagy::DEFAULT[:max_pages] = 3000 # example |
18 | | - |
19 | | - |
20 | | -# Extras |
21 | | -# See https://ddnexus.github.io/pagy/categories/extra |
22 | | - |
23 | | - |
24 | | -# Legacy Compatibility Extras |
25 | | - |
26 | | -# Size extra: Enable the Array type for the `:size` variable (e.g. `size: [1,4,4,1]`) |
27 | | -# See https://ddnexus.github.io/pagy/docs/extras/size |
28 | | -# require 'pagy/extras/size' # must be required before the other extras |
29 | | - |
30 | | - |
31 | | -# Backend Extras |
32 | | - |
33 | | -# Arel extra: For better performance utilizing grouped ActiveRecord collections: |
34 | | -# See: https://ddnexus.github.io/pagy/docs/extras/arel |
35 | | -# require 'pagy/extras/arel' |
36 | | - |
37 | | -# Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding |
38 | | -# See https://ddnexus.github.io/pagy/docs/extras/array |
39 | | -# require 'pagy/extras/array' |
40 | | - |
41 | | -# Calendar extra: Add pagination filtering by calendar time unit (year, quarter, month, week, day) |
42 | | -# See https://ddnexus.github.io/pagy/docs/extras/calendar |
43 | | -# require 'pagy/extras/calendar' |
44 | | -# Default for each calendar unit class in IRB: |
45 | | -# >> Pagy::Calendar::Year::DEFAULT |
46 | | -# >> Pagy::Calendar::Quarter::DEFAULT |
47 | | -# >> Pagy::Calendar::Month::DEFAULT |
48 | | -# >> Pagy::Calendar::Week::DEFAULT |
49 | | -# >> Pagy::Calendar::Day::DEFAULT |
| 6 | +############ Global Options ################################################################ |
| 7 | +# See https://ddnexus.github.io/pagy/toolbox/options/ for details. |
| 8 | +# Add your global options below. They will be applied globally. |
| 9 | +# For example: |
50 | 10 | # |
51 | | -# Pagy.options[:limit] = 10 # Limit the items per page |
52 | | -# Pagy.options[:client_max_limit] = 100 # The client can request a limit up to 100 |
53 | | -# Pagy.options[:max_pages] = 200 # Allow only 200 pages |
54 | | -# Pagy.options[:jsonapi] = true # Use JSON:API compliant URLs |
55 | | - |
56 | | - |
57 | | -# Frontend Extras |
58 | | - |
59 | | -# Bootstrap extra: Add nav, nav_js and combo_nav_js helpers and templates for Bootstrap pagination |
60 | | -# See https://ddnexus.github.io/pagy/docs/extras/bootstrap |
61 | | -# require "pagy/extras/bootstrap" |
62 | | - |
63 | | -# Bulma extra: Add nav, nav_js and combo_nav_js helpers and templates for Bulma pagination |
64 | | -# See https://ddnexus.github.io/pagy/docs/extras/bulma |
65 | | -# require 'pagy/extras/bulma' |
66 | | - |
67 | | -# Pagy extra: Add the pagy styled versions of the javascript-powered navs |
68 | | -# and a few other components to the Pagy::Frontend module. |
69 | | -# See https://ddnexus.github.io/pagy/docs/extras/pagy |
70 | | -# require 'pagy/extras/pagy' |
71 | | - |
72 | | -# Multi size var used by the *_nav_js helpers |
73 | | -# See https://ddnexus.github.io/pagy/docs/extras/pagy#steps |
74 | | -# Pagy::DEFAULT[:steps] = { 0 => 5, 540 => 7, 720 => 9 } # example |
75 | | - |
76 | | - |
77 | | -# Feature Extras |
78 | | - |
79 | | -# Gearbox extra: Automatically change the limit per page depending on the page number |
80 | | -# See https://ddnexus.github.io/pagy/docs/extras/gearbox |
81 | | -# require 'pagy/extras/gearbox' |
82 | | -# set to false only if you want to make :gearbox_extra an opt-in variable |
83 | | -# Pagy::DEFAULT[:gearbox_extra] = false # default true |
84 | | -# Pagy::DEFAULT[:gearbox_limit] = [15, 30, 60, 100] # default |
85 | | - |
86 | | -# Limit extra: Allow the client to request a custom limit per page with an optional selector UI |
87 | | -# See https://ddnexus.github.io/pagy/docs/extras/limit |
88 | | -# require 'pagy/extras/limit' |
89 | | -# set to false only if you want to make :limit_extra an opt-in variable |
90 | | -# Pagy::DEFAULT[:limit_extra] = false # default true |
91 | | -# Pagy::DEFAULT[:limit_param] = :limit # default |
92 | | -# Pagy::DEFAULT[:limit_max] = 100 # default |
93 | | - |
94 | | -# Overflow extra: Allow for easy handling of overflowing pages |
95 | | -# See https://ddnexus.github.io/pagy/docs/extras/overflow |
96 | | -# require 'pagy/extras/overflow' |
97 | | -# Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception) |
98 | | - |
99 | | -# Trim extra: Remove the page=1 param from links |
100 | | -# See https://ddnexus.github.io/pagy/docs/extras/trim |
101 | | -# require 'pagy/extras/trim' |
102 | | -# set to false only if you want to make :trim_extra an opt-in variable |
103 | | -# Pagy::DEFAULT[:trim_extra] = false # default true |
104 | | - |
105 | | -# Standalone extra: Use pagy in non Rack environment/gem |
106 | | -# See https://ddnexus.github.io/pagy/docs/extras/standalone |
107 | | -# require 'pagy/extras/standalone' |
108 | | -# Pagy::DEFAULT[:url] = 'http://www.example.com/subdir' # optional default |
109 | | - |
110 | | -# Jsonapi extra: Implements JSON:API specifications |
111 | | -# See https://ddnexus.github.io/pagy/docs/extras/jsonapi |
112 | | -# require 'pagy/extras/jsonapi' # must be required after the other extras |
113 | | -# set to false only if you want to make :jsonapi an opt-in variable |
114 | | -# Pagy::DEFAULT[:jsonapi] = false # default true |
115 | | - |
116 | | -# Rails |
117 | | -# Enable the .js file required by the helpers that use javascript |
118 | | -# (pagy*_nav_js, pagy*_combo_nav_js, and pagy_limit_selector_js) |
119 | | -# See https://ddnexus.github.io/pagy/docs/api/javascript |
120 | | - |
121 | | -# With the asset pipeline |
122 | | -# Sprockets need to look into the pagy javascripts dir, so add it to the assets paths |
123 | | -# Rails.application.config.assets.paths << Pagy.root.join('javascripts') |
124 | | - |
125 | | -# I18n |
126 | | - |
127 | | -# Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem |
128 | | -# See https://ddnexus.github.io/pagy/docs/api/i18n |
129 | | -# Notice: No need to configure anything in this section if your app uses only "en" |
130 | | -# or if you use the i18n extra below |
| 11 | +Pagy::OPTIONS[:limit] = 20 # Limit the items per page |
| 12 | +# Pagy::OPTIONS[:client_max_limit] = 100 # The client can request a limit up to 100 |
| 13 | +# Pagy::OPTIONS[:max_pages] = 200 # Allow only 200 pages |
| 14 | +# Pagy::OPTIONS[:jsonapi] = true # Use JSON:API compliant URLs |
| 15 | + |
| 16 | +Pagy::OPTIONS.freeze |
| 17 | + |
| 18 | +############ JavaScript #################################################################### |
| 19 | +# See https://ddnexus.github.io/pagy/resources/javascript/ for details. |
| 20 | +# Examples for Rails: |
| 21 | +# For apps with an assets pipeline |
| 22 | +# Rails.application.config.assets.paths << Pagy::ROOT.join('javascripts') |
131 | 23 | # |
132 | 24 | # For apps with a javascript builder (e.g. esbuild, webpack, etc.) |
133 | 25 | # javascript_dir = Rails.root.join('app/javascript') |
|
155 | 47 | # Rails or not. |
156 | 48 | # |
157 | 49 | # Pagy::Calendar.localize_with_rails_i18n_gem(*your_locales) |
158 | | - |
159 | | -# When you are done setting your own default freeze it, so it will not get changed accidentally |
160 | | -Pagy.options.freeze |
0 commit comments