You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
10 KiB

8 months ago
  1. # frozen_string_literal: true
  2. # Instance variables
  3. # See https://ddnexus.github.io/pagy/docs/api/pagy#instance-variables
  4. # Pagy::DEFAULT[:page] = 1 # default
  5. # Pagy::DEFAULT[:items] = 20 # default
  6. # Pagy::DEFAULT[:outset] = 0 # default
  7. # Other Variables
  8. # See https://ddnexus.github.io/pagy/docs/api/pagy#other-variables
  9. # Pagy::DEFAULT[:size] = [1,4,4,1] # default in pagy < 7.0
  10. # Pagy::DEFAULT[:page_param] = :page # default
  11. # Pagy::DEFAULT[:fragment] = '#fragment' # example
  12. # Pagy::DEFAULT[:link_extra] = 'data-remote="true"' # example
  13. # Pagy::DEFAULT[:cycle] = true # example
  14. # Pagy::DEFAULT[:request_path] = '/foo' # example
  15. # Pagy::DEFAULT[:count_args] = [] # example for non AR ORMs
  16. # Pagy::DEFAULT[:params] = {} # default
  17. # NOTICE: The :params can be also set as a lambda e.g:
  18. # ->(params){ params.exclude('useless').merge!('custom' => 'useful') }
  19. # Extras
  20. # See https://ddnexus.github.io/pagy/categories/extra
  21. # Backend Extras
  22. # Arel extra: For better performance utilizing grouped ActiveRecord collections:
  23. # See: https://ddnexus.github.io/pagy/docs/extras/arel
  24. # require 'pagy/extras/arel'
  25. # Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding
  26. # See https://ddnexus.github.io/pagy/docs/extras/array
  27. # require 'pagy/extras/array'
  28. # Calendar extra: Add pagination filtering by calendar time unit (year, quarter, month, week, day)
  29. # See https://ddnexus.github.io/pagy/docs/extras/calendar
  30. # require 'pagy/extras/calendar'
  31. # Default for each unit
  32. # Pagy::Calendar::Year::DEFAULT[:order] = :asc # Time direction of pagination
  33. # Pagy::Calendar::Year::DEFAULT[:format] = '%Y' # strftime format
  34. #
  35. # Pagy::Calendar::Quarter::DEFAULT[:order] = :asc # Time direction of pagination
  36. # Pagy::Calendar::Quarter::DEFAULT[:format] = '%Y-Q%q' # strftime format
  37. #
  38. # Pagy::Calendar::Month::DEFAULT[:order] = :asc # Time direction of pagination
  39. # Pagy::Calendar::Month::DEFAULT[:format] = '%Y-%m' # strftime format
  40. #
  41. # Pagy::Calendar::Week::DEFAULT[:order] = :asc # Time direction of pagination
  42. # Pagy::Calendar::Week::DEFAULT[:format] = '%Y-%W' # strftime format
  43. #
  44. # Pagy::Calendar::Day::DEFAULT[:order] = :asc # Time direction of pagination
  45. # Pagy::Calendar::Day::DEFAULT[:format] = '%Y-%m-%d' # strftime format
  46. #
  47. # Uncomment the following lines, if you need calendar localization without using the I18n extra
  48. # module LocalizePagyCalendar
  49. # def localize(time, opts)
  50. # ::I18n.l(time, **opts)
  51. # end
  52. # end
  53. # Pagy::Calendar.prepend LocalizePagyCalendar
  54. # Countless extra: Paginate without any count, saving one query per rendering
  55. # See https://ddnexus.github.io/pagy/docs/extras/countless
  56. # require 'pagy/extras/countless'
  57. # Pagy::DEFAULT[:countless_minimal] = false # default (eager loading)
  58. # Elasticsearch Rails extra: Paginate `ElasticsearchRails::Results` objects
  59. # See https://ddnexus.github.io/pagy/docs/extras/elasticsearch_rails
  60. # Default :pagy_search method: change only if you use also
  61. # the searchkick or meilisearch extra that defines the same
  62. # Pagy::DEFAULT[:elasticsearch_rails_pagy_search] = :pagy_search
  63. # Default original :search method called internally to do the actual search
  64. # Pagy::DEFAULT[:elasticsearch_rails_search] = :search
  65. # require 'pagy/extras/elasticsearch_rails'
  66. # Headers extra: http response headers (and other helpers) useful for API pagination
  67. # See http://ddnexus.github.io/pagy/extras/headers
  68. # require 'pagy/extras/headers'
  69. # Pagy::DEFAULT[:headers] = { page: 'Current-Page',
  70. # items: 'Page-Items',
  71. # count: 'Total-Count',
  72. # pages: 'Total-Pages' } # default
  73. # Meilisearch extra: Paginate `Meilisearch` result objects
  74. # See https://ddnexus.github.io/pagy/docs/extras/meilisearch
  75. # Default :pagy_search method: change only if you use also
  76. # the elasticsearch_rails or searchkick extra that define the same method
  77. # Pagy::DEFAULT[:meilisearch_pagy_search] = :pagy_search
  78. # Default original :search method called internally to do the actual search
  79. # Pagy::DEFAULT[:meilisearch_search] = :ms_search
  80. # require 'pagy/extras/meilisearch'
  81. # Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
  82. # See https://ddnexus.github.io/pagy/docs/extras/metadata
  83. # you must require the frontend helpers internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
  84. # require 'pagy/extras/frontend_helpers'
  85. # require 'pagy/extras/metadata'
  86. # For performance reasons, you should explicitly set ONLY the metadata you use in the frontend
  87. # Pagy::DEFAULT[:metadata] = %i[scaffold_url page prev next last] # example
  88. # Searchkick extra: Paginate `Searchkick::Results` objects
  89. # See https://ddnexus.github.io/pagy/docs/extras/searchkick
  90. # Default :pagy_search method: change only if you use also
  91. # the elasticsearch_rails or meilisearch extra that defines the same
  92. # DEFAULT[:searchkick_pagy_search] = :pagy_search
  93. # Default original :search method called internally to do the actual search
  94. # Pagy::DEFAULT[:searchkick_search] = :search
  95. # require 'pagy/extras/searchkick'
  96. # uncomment if you are going to use Searchkick.pagy_search
  97. # Searchkick.extend Pagy::Searchkick
  98. # Frontend Extras
  99. # Bootstrap extra: Add nav, nav_js and combo_nav_js helpers and templates for Bootstrap pagination
  100. # See https://ddnexus.github.io/pagy/docs/extras/bootstrap
  101. # require 'pagy/extras/bootstrap'
  102. # Bulma extra: Add nav, nav_js and combo_nav_js helpers and templates for Bulma pagination
  103. # See https://ddnexus.github.io/pagy/docs/extras/bulma
  104. # require 'pagy/extras/bulma'
  105. # Foundation extra: Add nav, nav_js and combo_nav_js helpers and templates for Foundation pagination
  106. # See https://ddnexus.github.io/pagy/docs/extras/foundation
  107. # require 'pagy/extras/foundation'
  108. # Materialize extra: Add nav, nav_js and combo_nav_js helpers for Materialize pagination
  109. # See https://ddnexus.github.io/pagy/docs/extras/materialize
  110. # require 'pagy/extras/materialize'
  111. # Pagy extra: Add the pagy styled versions of the javascript-powered navs
  112. # and a few other components to the Pagy::Frontend module.
  113. # See https://ddnexus.github.io/pagy/docs/extras/pagy
  114. # require 'pagy/extras/pagy'
  115. # Semantic extra: Add nav, nav_js and combo_nav_js helpers for Semantic UI pagination
  116. # See https://ddnexus.github.io/pagy/docs/extras/semantic
  117. # require 'pagy/extras/semantic'
  118. # UIkit extra: Add nav helper and templates for UIkit pagination
  119. # See https://ddnexus.github.io/pagy/docs/extras/uikit
  120. # require 'pagy/extras/uikit'
  121. # Multi size var used by the *_nav_js helpers
  122. # See https://ddnexus.github.io/pagy/docs/extras/pagy#steps
  123. # Pagy::DEFAULT[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example
  124. # Feature Extras
  125. # Gearbox extra: Automatically change the number of items per page depending on the page number
  126. # See https://ddnexus.github.io/pagy/docs/extras/gearbox
  127. # require 'pagy/extras/gearbox'
  128. # set to false only if you want to make :gearbox_extra an opt-in variable
  129. # Pagy::DEFAULT[:gearbox_extra] = false # default true
  130. # Pagy::DEFAULT[:gearbox_items] = [15, 30, 60, 100] # default
  131. # Items extra: Allow the client to request a custom number of items per page with an optional selector UI
  132. # See https://ddnexus.github.io/pagy/docs/extras/items
  133. # require 'pagy/extras/items'
  134. # set to false only if you want to make :items_extra an opt-in variable
  135. # Pagy::DEFAULT[:items_extra] = false # default true
  136. # Pagy::DEFAULT[:items_param] = :items # default
  137. # Pagy::DEFAULT[:max_items] = 100 # default
  138. # Overflow extra: Allow for easy handling of overflowing pages
  139. # See https://ddnexus.github.io/pagy/docs/extras/overflow
  140. # require 'pagy/extras/overflow'
  141. # Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception)
  142. # Trim extra: Remove the page=1 param from links
  143. # See https://ddnexus.github.io/pagy/docs/extras/trim
  144. # require 'pagy/extras/trim'
  145. # set to false only if you want to make :trim_extra an opt-in variable
  146. # Pagy::DEFAULT[:trim_extra] = false # default true
  147. # Standalone extra: Use pagy in non Rack environment/gem
  148. # See https://ddnexus.github.io/pagy/docs/extras/standalone
  149. # require 'pagy/extras/standalone'
  150. # Pagy::DEFAULT[:url] = 'http://www.example.com/subdir' # optional default
  151. # Jsonapi extra: Implements JSON:API specifications
  152. # See https://ddnexus.github.io/pagy/docs/extras/jsonapi
  153. # require 'pagy/extras/jsonapi' # must be required after the other extras
  154. # set to false only if you want to make :jsonapi an opt-in variable
  155. # Pagy::DEFAULT[:jsonapi] = false # default true
  156. # Rails
  157. # Enable the .js file required by the helpers that use javascript
  158. # (pagy*_nav_js, pagy*_combo_nav_js, and pagy_items_selector_js)
  159. # See https://ddnexus.github.io/pagy/docs/api/javascript
  160. # With the asset pipeline
  161. # Sprockets need to look into the pagy javascripts dir, so add it to the assets paths
  162. # Rails.application.config.assets.paths << Pagy.root.join('javascripts')
  163. # I18n
  164. # Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem
  165. # See https://ddnexus.github.io/pagy/docs/api/i18n
  166. # Notice: No need to configure anything in this section if your app uses only "en"
  167. # or if you use the i18n extra below
  168. #
  169. # Examples:
  170. # load the "de" built-in locale:
  171. Pagy::I18n.load(locale: 'fr')
  172. #
  173. # load the "de" locale defined in the custom file at :filepath:
  174. # Pagy::I18n.load(locale: 'de', filepath: 'path/to/pagy-de.yml')
  175. #
  176. # load the "de", "en" and "es" built-in locales:
  177. # (the first passed :locale will be used also as the default_locale)
  178. # Pagy::I18n.load({ locale: 'de' },
  179. # { locale: 'en' },
  180. # { locale: 'es' })
  181. #
  182. # load the "en" built-in locale, a custom "es" locale,
  183. # and a totally custom locale complete with a custom :pluralize proc:
  184. # (the first passed :locale will be used also as the default_locale)
  185. # Pagy::I18n.load({ locale: 'en' },
  186. # { locale: 'es', filepath: 'path/to/pagy-es.yml' },
  187. # { locale: 'xyz', # not built-in
  188. # filepath: 'path/to/pagy-xyz.yml',
  189. # pluralize: lambda{ |count| ... } )
  190. # I18n extra: uses the standard i18n gem which is ~18x slower using ~10x more memory
  191. # than the default pagy internal i18n (see above)
  192. # See https://ddnexus.github.io/pagy/docs/extras/i18n
  193. # require 'pagy/extras/i18n'
  194. # When you are done setting your own default freeze it, so it will not get changed accidentally
  195. Pagy::DEFAULT.freeze