geoblacklight_admin 0.0.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +59 -36
  3. data/Rakefile +47 -14
  4. data/app/assets/javascripts/geoblacklight_admin.js +2 -1
  5. data/app/assets/stylesheets/geoblacklight_admin/_core.scss +5 -0
  6. data/app/assets/stylesheets/geoblacklight_admin/modules/_chosen.scss +425 -0
  7. data/app/assets/stylesheets/geoblacklight_admin/modules/_forms.scss +108 -0
  8. data/app/controllers/admin/admin_controller.rb +4 -2
  9. data/app/controllers/admin/advanced_search_controller.rb +123 -103
  10. data/app/controllers/admin/api_controller.rb +123 -108
  11. data/app/controllers/admin/bookmarks_controller.rb +4 -4
  12. data/app/controllers/admin/bulk_actions_controller.rb +9 -4
  13. data/app/controllers/admin/concerns/upload_util.rb +2 -0
  14. data/app/controllers/admin/document_accesses_controller.rb +10 -4
  15. data/app/controllers/admin/document_assets_controller.rb +14 -11
  16. data/app/controllers/admin/document_downloads_controller.rb +12 -10
  17. data/app/controllers/admin/documents_controller.rb +32 -15
  18. data/app/controllers/admin/elements_controller.rb +6 -5
  19. data/app/controllers/admin/form_elements_controller.rb +4 -4
  20. data/app/controllers/admin/ids_controller.rb +107 -87
  21. data/app/controllers/admin/import_documents_controller.rb +1 -1
  22. data/app/controllers/admin/imports_controller.rb +7 -3
  23. data/app/controllers/admin/mappings_controller.rb +6 -4
  24. data/app/controllers/admin/notifications_controller.rb +1 -1
  25. data/app/controllers/admin/search_controller.rb +3 -2
  26. data/app/controllers/admin/users_controller.rb +2 -2
  27. data/app/helpers/form_input_helper.rb +4 -4
  28. data/app/helpers/geoblacklight_admin_helper.rb +1 -1
  29. data/app/indexers/document_indexer.rb +1 -1
  30. data/app/jobs/export_job.rb +9 -6
  31. data/app/jobs/export_json_bulk_job.rb +95 -0
  32. data/app/jobs/export_json_job.rb +14 -12
  33. data/app/models/admin/bookmark.rb +18 -0
  34. data/app/models/api_search_builder.rb +3 -1
  35. data/app/models/blacklight_api.rb +6 -6
  36. data/app/models/blacklight_api_facets.rb +7 -2
  37. data/app/models/blacklight_api_ids.rb +3 -4
  38. data/app/models/bulk_action.rb +1 -1
  39. data/app/models/document/bbox_validator.rb +9 -5
  40. data/app/models/document/date_range_validator.rb +13 -10
  41. data/app/models/document/geom_validator.rb +4 -2
  42. data/app/models/document.rb +15 -7
  43. data/app/models/element.rb +9 -7
  44. data/app/models/form_control.rb +2 -0
  45. data/app/models/form_element.rb +2 -0
  46. data/app/models/form_feature.rb +2 -0
  47. data/app/models/form_group.rb +2 -0
  48. data/app/models/form_header.rb +2 -0
  49. data/app/models/geoblacklight_admin/schema.rb +5 -2
  50. data/app/models/geoblacklight_admin.rb +2 -0
  51. data/app/models/import/csv_duplicates_validator.rb +2 -1
  52. data/app/models/import/csv_header_validator.rb +2 -1
  53. data/app/models/import.rb +4 -7
  54. data/app/models/user.rb +1 -1
  55. data/app/services/export_csv_service.rb +5 -1
  56. data/app/views/admin/advanced_search/facets.json.jbuilder +9 -8
  57. data/app/views/admin/advanced_search/index.json.jbuilder +8 -7
  58. data/app/views/admin/api/_field.json.jbuilder +1 -1
  59. data/app/views/admin/api/fetch.json.jbuilder +8 -7
  60. data/app/views/admin/api/index.json.jbuilder +8 -7
  61. data/app/views/admin/bookmarks/index.html.erb +2 -2
  62. data/app/views/admin/bulk_actions/index.html.erb +3 -3
  63. data/app/views/admin/bulk_actions/show.html.erb +1 -1
  64. data/app/views/admin/document_accesses/_form.html.erb +1 -1
  65. data/app/views/admin/document_accesses/destroy_all.html.erb +3 -3
  66. data/app/views/admin/document_accesses/edit.html.erb +1 -1
  67. data/app/views/admin/document_accesses/import.html.erb +2 -2
  68. data/app/views/admin/document_accesses/index.html.erb +9 -9
  69. data/app/views/admin/document_accesses/new.html.erb +1 -1
  70. data/app/views/admin/document_downloads/_form.html.erb +1 -1
  71. data/app/views/admin/document_downloads/destroy_all.html.erb +2 -2
  72. data/app/views/admin/document_downloads/edit.html.erb +2 -3
  73. data/app/views/admin/document_downloads/import.html.erb +1 -1
  74. data/app/views/admin/document_downloads/index.html.erb +9 -9
  75. data/app/views/admin/document_downloads/new.html.erb +1 -1
  76. data/app/views/admin/document_downloads/show.html.erb +2 -2
  77. data/app/views/admin/documents/_document_bookmark.html.erb +1 -1
  78. data/app/views/admin/documents/_form_nav.html.erb +3 -1
  79. data/app/views/admin/documents/_json_btaa_aardvark.jbuilder +1 -3
  80. data/app/views/admin/documents/_json_file.jbuilder +14 -0
  81. data/app/views/admin/documents/_result_selected_options.html.erb +3 -1
  82. data/app/views/admin/documents/edit.html.erb +1 -1
  83. data/app/views/admin/documents/features/_multiple_download_links.html.erb +2 -2
  84. data/app/views/admin/documents/fetch.json_file.jbuilder +9 -0
  85. data/app/views/admin/documents/index.html.erb +2 -4
  86. data/app/views/admin/documents/index.json_file.jbuilder +9 -0
  87. data/app/views/admin/documents/versions.html.erb +1 -1
  88. data/app/views/admin/elements/_element.json.jbuilder +4 -1
  89. data/app/views/admin/elements/_form.html.erb +1 -1
  90. data/app/views/admin/elements/edit.html.erb +2 -2
  91. data/app/views/admin/elements/index.html.erb +4 -4
  92. data/app/views/admin/elements/index.json.jbuilder +2 -0
  93. data/app/views/admin/elements/new.html.erb +1 -1
  94. data/app/views/admin/elements/show.html.erb +6 -6
  95. data/app/views/admin/elements/show.json.jbuilder +2 -0
  96. data/app/views/admin/form_elements/_form.html.erb +1 -1
  97. data/app/views/admin/form_elements/_form_element.json.jbuilder +2 -0
  98. data/app/views/admin/form_elements/edit.html.erb +2 -2
  99. data/app/views/admin/form_elements/index.html.erb +2 -2
  100. data/app/views/admin/form_elements/index.json.jbuilder +2 -0
  101. data/app/views/admin/form_elements/new.html.erb +1 -1
  102. data/app/views/admin/form_elements/show.html.erb +2 -2
  103. data/app/views/admin/form_elements/show.json.jbuilder +2 -0
  104. data/app/views/admin/ids/fetch.json.jbuilder +8 -7
  105. data/app/views/admin/ids/index.json.jbuilder +3 -2
  106. data/app/views/admin/import_documents/show.html.haml +1 -1
  107. data/app/views/admin/imports/_import.json.jbuilder +2 -1
  108. data/app/views/admin/imports/_show_failed_tab.html.erb +2 -2
  109. data/app/views/admin/imports/_show_success_tab.html.erb +1 -1
  110. data/app/views/admin/imports/edit.html.erb +3 -3
  111. data/app/views/admin/imports/index.html.erb +3 -3
  112. data/app/views/admin/layouts/application.html.erb +4 -4
  113. data/app/views/admin/mappings/_form.html.erb +1 -1
  114. data/app/views/admin/mappings/_mapping.json.jbuilder +2 -1
  115. data/app/views/admin/mappings/edit.html.erb +2 -2
  116. data/app/views/admin/mappings/new.html.erb +1 -1
  117. data/app/views/admin/mappings/show.html.erb +2 -2
  118. data/app/views/admin/notifications/index.html.erb +3 -3
  119. data/app/views/admin/search/index.html.erb +2 -2
  120. data/app/views/admin/shared/_navbar.html.erb +11 -6
  121. data/app/views/admin/shared/_toast.html.erb +1 -1
  122. data/app/views/admin/users/index.html.erb +1 -1
  123. data/app/views/catalog/_show_gbl_admin.html.erb +3 -0
  124. data/config/locales/documents.en.yml +3 -0
  125. data/config/routes.rb +37 -33
  126. data/db/migrate/20230316183001_add_geoblacklight_admin_gem.rb +409 -0
  127. data/db/seeds.rb +7 -6
  128. data/db/seeds_elements.csv +56 -55
  129. data/db/seeds_elements.numbers +0 -0
  130. data/db/seeds_form_elements.csv +65 -64
  131. data/db/seeds_form_elements.numbers +0 -0
  132. data/lib/generators/geoblacklight_admin/config_generator.rb +61 -94
  133. data/lib/generators/geoblacklight_admin/install_generator.rb +3 -12
  134. data/lib/generators/geoblacklight_admin/jobs_generator.rb +3 -2
  135. data/lib/generators/geoblacklight_admin/models_generator.rb +0 -1
  136. data/lib/generators/geoblacklight_admin/templates/_show_sidebar.html.erb +19 -0
  137. data/lib/generators/geoblacklight_admin/templates/_user_util_links.html.erb +1 -1
  138. data/lib/generators/geoblacklight_admin/templates/config/database.yml +9 -5
  139. data/lib/generators/geoblacklight_admin/templates/config/geomg_aardvark_schema.json +12 -6
  140. data/lib/generators/geoblacklight_admin/templates/config/initializers/devise.rb +315 -0
  141. data/lib/generators/geoblacklight_admin/templates/config/initializers/geoblacklight_admin.rb +1 -2
  142. data/lib/generators/geoblacklight_admin/templates/config/initializers/kithe.rb +2 -0
  143. data/lib/generators/geoblacklight_admin/templates/config/initializers/mime_types.rb +15 -0
  144. data/lib/generators/geoblacklight_admin/templates/config/initializers/pagy.rb +152 -68
  145. data/lib/generators/geoblacklight_admin/templates/config/initializers/simple_form.rb +178 -0
  146. data/lib/generators/geoblacklight_admin/templates/config/initializers/simple_form_bootstrap.rb +365 -0
  147. data/lib/generators/geoblacklight_admin/templates/config/settings.yml +293 -0
  148. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/results_controller.js +10 -0
  149. data/lib/generators/geoblacklight_admin/templates/package.json +3 -0
  150. data/lib/generators/geoblacklight_admin/templates/solr/conf/schema.xml +3 -3
  151. data/lib/generators/geoblacklight_admin/views_generator.rb +2 -3
  152. data/lib/geoblacklight_admin/engine.rb +5 -6
  153. data/lib/geoblacklight_admin/version.rb +1 -1
  154. data/lib/geoblacklight_admin.rb +1 -1
  155. data/lib/tasks/geoblacklight_admin.rake +15 -11
  156. metadata +101 -63
  157. data/.editorconfig +0 -18
  158. data/.gitignore +0 -75
  159. data/.standard.yml +0 -4
  160. data/Gemfile +0 -59
  161. data/LICENSE +0 -21
  162. data/app/assets/images/.keep +0 -0
  163. data/app/controllers/admin/concerns/.keep +0 -0
  164. data/app/models/bookmark.rb +0 -17
  165. data/app/models/concerns/.keep +0 -0
  166. data/db/migrate/20230316183001_add_geoblacklight_admin.rb +0 -399
  167. data/geoblacklight_admin.gemspec +0 -67
  168. data/lib/generators/geoblacklight_admin/example_docs_generator.rb +0 -18
  169. data/lib/generators/geoblacklight_admin/templates/.env.development.example +0 -28
  170. data/lib/generators/geoblacklight_admin/templates/.solr_wrapper.yml +0 -7
  171. data/lib/generators/geoblacklight_admin/templates/solr/snapshots/.keep +0 -0
  172. data/lib/tasks/.keep +0 -0
  173. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -35
  174. data/template.rb +0 -16
  175. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/confirmations/new.html.erb +0 -0
  176. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/invitations/edit.html.erb +0 -0
  177. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/invitations/new.html.erb +0 -0
  178. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/mailer/invitation_instructions.html.erb +0 -0
  179. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/mailer/invitation_instructions.text.erb +0 -0
  180. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/passwords/edit.html.erb +0 -0
  181. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/passwords/new.html.erb +0 -0
  182. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/registrations/edit.html.erb +0 -0
  183. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/registrations/new.html.erb +0 -0
  184. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/sessions/new.html.erb +0 -0
  185. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/shared/_links.html.erb +0 -0
  186. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/unlocks/new.html.erb +0 -0
@@ -1,129 +1,210 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Pagy initializer file (3.8.3)
4
- # Customize only what you really need and notice that Pagy works also without any of the following lines.
3
+ require "pagy"
4
+
5
+ # Pagy initializer file (6.0.4)
6
+ # Customize only what you really need and notice that the core Pagy works also without any of the following lines.
5
7
  # Should you just cherry pick part of this file, please maintain the require-order of the extras
6
8
 
9
+ # Pagy DEFAULT Variables
10
+ # See https://ddnexus.github.io/pagy/docs/api/pagy#variables
11
+ # All the Pagy::DEFAULT are set for all the Pagy instances but can be overridden per instance by just passing them to
12
+ # Pagy.new|Pagy::Countless.new|Pagy::Calendar::*.new or any of the #pagy* controller methods
13
+
14
+ # Instance variables
15
+ # See https://ddnexus.github.io/pagy/docs/api/pagy#instance-variables
16
+ # Pagy::DEFAULT[:page] = 1 # default
17
+ # Pagy::DEFAULT[:items] = 20 # default
18
+ # Pagy::DEFAULT[:outset] = 0 # default
19
+
20
+ # Other Variables
21
+ # See https://ddnexus.github.io/pagy/docs/api/pagy#other-variables
22
+ # Pagy::DEFAULT[:size] = [1,4,4,1] # default
23
+ # Pagy::DEFAULT[:page_param] = :page # default
24
+ # The :params can be also set as a lambda e.g ->(params){ params.exclude('useless').merge!('custom' => 'useful') }
25
+ # Pagy::DEFAULT[:params] = {} # default
26
+ # Pagy::DEFAULT[:fragment] = '#fragment' # example
27
+ # Pagy::DEFAULT[:link_extra] = 'data-remote="true"' # example
28
+ # Pagy::DEFAULT[:i18n_key] = 'pagy.item_name' # default
29
+ # Pagy::DEFAULT[:cycle] = true # example
30
+ # Pagy::DEFAULT[:request_path] = "/foo" # example
31
+
7
32
  # Extras
8
- # See https://ddnexus.github.io/pagy/extras
33
+ # See https://ddnexus.github.io/pagy/categories/extra
9
34
 
10
35
  # Backend Extras
11
36
 
37
+ # Arel extra: For better performance utilizing grouped ActiveRecord collections:
38
+ # See: https://ddnexus.github.io/pagy/docs/extras/arel
39
+ # require 'pagy/extras/arel'
40
+
12
41
  # Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding
13
- # See https://ddnexus.github.io/pagy/extras/array
42
+ # See https://ddnexus.github.io/pagy/docs/extras/array
14
43
  # require 'pagy/extras/array'
15
44
 
45
+ # Calendar extra: Add pagination filtering by calendar time unit (year, quarter, month, week, day)
46
+ # See https://ddnexus.github.io/pagy/docs/extras/calendar
47
+ # require 'pagy/extras/calendar'
48
+ # Default for each unit
49
+ # Pagy::Calendar::Year::DEFAULT[:order] = :asc # Time direction of pagination
50
+ # Pagy::Calendar::Year::DEFAULT[:format] = '%Y' # strftime format
51
+ #
52
+ # Pagy::Calendar::Quarter::DEFAULT[:order] = :asc # Time direction of pagination
53
+ # Pagy::Calendar::Quarter::DEFAULT[:format] = '%Y-Q%q' # strftime format
54
+ #
55
+ # Pagy::Calendar::Month::DEFAULT[:order] = :asc # Time direction of pagination
56
+ # Pagy::Calendar::Month::DEFAULT[:format] = '%Y-%m' # strftime format
57
+ #
58
+ # Pagy::Calendar::Week::DEFAULT[:order] = :asc # Time direction of pagination
59
+ # Pagy::Calendar::Week::DEFAULT[:format] = '%Y-%W' # strftime format
60
+ #
61
+ # Pagy::Calendar::Day::DEFAULT[:order] = :asc # Time direction of pagination
62
+ # Pagy::Calendar::Day::DEFAULT[:format] = '%Y-%m-%d' # strftime format
63
+ #
64
+ # Uncomment the following lines, if you need calendar localization without using the I18n extra
65
+ # module LocalizePagyCalendar
66
+ # def localize(time, opts)
67
+ # ::I18n.l(time, **opts)
68
+ # end
69
+ # end
70
+ # Pagy::Calendar.prepend LocalizePagyCalendar
71
+
16
72
  # Countless extra: Paginate without any count, saving one query per rendering
17
- # See https://ddnexus.github.io/pagy/extras/countless
73
+ # See https://ddnexus.github.io/pagy/docs/extras/countless
18
74
  # require 'pagy/extras/countless'
19
- # Pagy::VARS[:cycle] = false # default
75
+ # Pagy::DEFAULT[:countless_minimal] = false # default (eager loading)
20
76
 
21
77
  # Elasticsearch Rails extra: Paginate `ElasticsearchRails::Results` objects
22
- # See https://ddnexus.github.io/pagy/extras/elasticsearch_rails
78
+ # See https://ddnexus.github.io/pagy/docs/extras/elasticsearch_rails
79
+ # Default :pagy_search method: change only if you use also
80
+ # the searchkick or meilisearch extra that defines the same
81
+ # Pagy::DEFAULT[:elasticsearch_rails_pagy_search] = :pagy_search
82
+ # Default original :search method called internally to do the actual search
83
+ # Pagy::DEFAULT[:elasticsearch_rails_search] = :search
23
84
  # require 'pagy/extras/elasticsearch_rails'
24
85
 
86
+ # Headers extra: http response headers (and other helpers) useful for API pagination
87
+ # See http://ddnexus.github.io/pagy/extras/headers
88
+ # require 'pagy/extras/headers'
89
+ # Pagy::DEFAULT[:headers] = { page: 'Current-Page',
90
+ # items: 'Page-Items',
91
+ # count: 'Total-Count',
92
+ # pages: 'Total-Pages' } # default
93
+
94
+ # Meilisearch extra: Paginate `Meilisearch` result objects
95
+ # See https://ddnexus.github.io/pagy/docs/extras/meilisearch
96
+ # Default :pagy_search method: change only if you use also
97
+ # the elasticsearch_rails or searchkick extra that define the same method
98
+ # Pagy::DEFAULT[:meilisearch_pagy_search] = :pagy_search
99
+ # Default original :search method called internally to do the actual search
100
+ # Pagy::DEFAULT[:meilisearch_search] = :ms_search
101
+ # require 'pagy/extras/meilisearch'
102
+
103
+ # Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
104
+ # See https://ddnexus.github.io/pagy/docs/extras/metadata
105
+ # you must require the frontend helpers internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
106
+ # require 'pagy/extras/frontend_helpers'
107
+ # require 'pagy/extras/metadata'
108
+ # For performance reasons, you should explicitly set ONLY the metadata you use in the frontend
109
+ # Pagy::DEFAULT[:metadata] = %i[scaffold_url page prev next last] # example
110
+
25
111
  # Searchkick extra: Paginate `Searchkick::Results` objects
26
- # See https://ddnexus.github.io/pagy/extras/searchkick
112
+ # See https://ddnexus.github.io/pagy/docs/extras/searchkick
113
+ # Default :pagy_search method: change only if you use also
114
+ # the elasticsearch_rails or meilisearch extra that defines the same
115
+ # DEFAULT[:searchkick_pagy_search] = :pagy_search
116
+ # Default original :search method called internally to do the actual search
117
+ # Pagy::DEFAULT[:searchkick_search] = :search
27
118
  # require 'pagy/extras/searchkick'
119
+ # uncomment if you are going to use Searchkick.pagy_search
120
+ # Searchkick.extend Pagy::Searchkick
28
121
 
29
122
  # Frontend Extras
30
123
 
31
124
  # Bootstrap extra: Add nav, nav_js and combo_nav_js helpers and templates for Bootstrap pagination
32
- # See https://ddnexus.github.io/pagy/extras/bootstrap
125
+ # See https://ddnexus.github.io/pagy/docs/extras/bootstrap
33
126
  require "pagy/extras/bootstrap"
34
127
 
35
128
  # Bulma extra: Add nav, nav_js and combo_nav_js helpers and templates for Bulma pagination
36
- # See https://ddnexus.github.io/pagy/extras/bulma
129
+ # See https://ddnexus.github.io/pagy/docs/extras/bulma
37
130
  # require 'pagy/extras/bulma'
38
131
 
39
132
  # Foundation extra: Add nav, nav_js and combo_nav_js helpers and templates for Foundation pagination
40
- # See https://ddnexus.github.io/pagy/extras/foundation
133
+ # See https://ddnexus.github.io/pagy/docs/extras/foundation
41
134
  # require 'pagy/extras/foundation'
42
135
 
43
136
  # Materialize extra: Add nav, nav_js and combo_nav_js helpers for Materialize pagination
44
- # See https://ddnexus.github.io/pagy/extras/materialize
137
+ # See https://ddnexus.github.io/pagy/docs/extras/materialize
45
138
  # require 'pagy/extras/materialize'
46
139
 
47
140
  # Navs extra: Add nav_js and combo_nav_js javascript helpers
48
141
  # Notice: the other frontend extras add their own framework-styled versions,
49
142
  # so require this extra only if you need the unstyled version
50
- # See https://ddnexus.github.io/pagy/extras/navs
143
+ # See https://ddnexus.github.io/pagy/docs/extras/navs
51
144
  # require 'pagy/extras/navs'
52
145
 
53
146
  # Semantic extra: Add nav, nav_js and combo_nav_js helpers for Semantic UI pagination
54
- # See https://ddnexus.github.io/pagy/extras/semantic
147
+ # See https://ddnexus.github.io/pagy/docs/extras/semantic
55
148
  # require 'pagy/extras/semantic'
56
149
 
57
150
  # UIkit extra: Add nav helper and templates for UIkit pagination
58
- # See https://ddnexus.github.io/pagy/extras/uikit
151
+ # See https://ddnexus.github.io/pagy/docs/extras/uikit
59
152
  # require 'pagy/extras/uikit'
60
153
 
61
154
  # Multi size var used by the *_nav_js helpers
62
- # See https://ddnexus.github.io/pagy/extras/navs#steps
63
- # Pagy::VARS[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example
155
+ # See https://ddnexus.github.io/pagy/docs/extras/navs#steps
156
+ # Pagy::DEFAULT[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example
64
157
 
65
158
  # Feature Extras
66
159
 
67
- # Headers extra: http response headers (and other helpers) useful for API pagination
68
- # See http://ddnexus.github.io/pagy/extras/headers
69
- # require 'pagy/extras/headers'
70
- # Pagy::VARS[:headers] = { page: 'Current-Page', items: 'Page-Items', count: 'Total-Count', pages: 'Total-Pages' } # default
71
-
72
- # Support extra: Extra support for features like: incremental, infinite, auto-scroll pagination
73
- # See https://ddnexus.github.io/pagy/extras/support
74
- # require 'pagy/extras/support'
160
+ # Gearbox extra: Automatically change the number of items per page depending on the page number
161
+ # See https://ddnexus.github.io/pagy/docs/extras/gearbox
162
+ # require 'pagy/extras/gearbox'
163
+ # set to false only if you want to make :gearbox_extra an opt-in variable
164
+ # Pagy::DEFAULT[:gearbox_extra] = false # default true
165
+ # Pagy::DEFAULT[:gearbox_items] = [15, 30, 60, 100] # default
75
166
 
76
167
  # Items extra: Allow the client to request a custom number of items per page with an optional selector UI
77
- # See https://ddnexus.github.io/pagy/extras/items
168
+ # See https://ddnexus.github.io/pagy/docs/extras/items
78
169
  # require 'pagy/extras/items'
79
- # Pagy::VARS[:items_param] = :items # default
80
- # Pagy::VARS[:max_items] = 100 # default
170
+ # set to false only if you want to make :items_extra an opt-in variable
171
+ # Pagy::DEFAULT[:items_extra] = false # default true
172
+ # Pagy::DEFAULT[:items_param] = :items # default
173
+ # Pagy::DEFAULT[:max_items] = 100 # default
81
174
 
82
175
  # Overflow extra: Allow for easy handling of overflowing pages
83
- # See https://ddnexus.github.io/pagy/extras/overflow
176
+ # See https://ddnexus.github.io/pagy/docs/extras/overflow
84
177
  # require 'pagy/extras/overflow'
85
- # Pagy::VARS[:overflow] = :empty_page # default (other options: :last_page and :exception)
178
+ # Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception)
86
179
 
87
- # Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
88
- # See https://ddnexus.github.io/pagy/extras/metadata
89
- # you must require the shared internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
90
- # require 'pagy/extras/shared'
91
- # require 'pagy/extras/metadata'
92
- # For performance reason, you should explicitly set ONLY the metadata you use in the frontend
93
- # Pagy::VARS[:metadata] = [:scaffold_url, :count, :page, :prev, :next, :last] # example
180
+ # Support extra: Extra support for features like: incremental, infinite, auto-scroll pagination
181
+ # See https://ddnexus.github.io/pagy/docs/extras/support
182
+ # require 'pagy/extras/support'
94
183
 
95
184
  # Trim extra: Remove the page=1 param from links
96
- # See https://ddnexus.github.io/pagy/extras/trim
185
+ # See https://ddnexus.github.io/pagy/docs/extras/trim
97
186
  # require 'pagy/extras/trim'
187
+ # set to false only if you want to make :trim_extra an opt-in variable
188
+ # Pagy::DEFAULT[:trim_extra] = false # default true
98
189
 
99
- # Pagy Variables
100
- # See https://ddnexus.github.io/pagy/api/pagy#variables
101
- # All the Pagy::VARS are set for all the Pagy instances but can be overridden
102
- # per instance by just passing them to Pagy.new or the #pagy controller method
103
-
104
- # Instance variables
105
- # See https://ddnexus.github.io/pagy/api/pagy#instance-variables
106
- Pagy::VARS[:items] = 10 # default
107
-
108
- # Other Variables
109
- # See https://ddnexus.github.io/pagy/api/pagy#other-variables
110
- # Pagy::VARS[:size] = [1,4,4,1] # default
111
- # Pagy::VARS[:page_param] = :page # default
112
- # Pagy::VARS[:params] = {} # default
113
- # Pagy::VARS[:anchor] = '#anchor' # example
114
- # Pagy::VARS[:link_extra] = 'data-remote="true"' # example
190
+ # Standalone extra: Use pagy in non Rack environment/gem
191
+ # See https://ddnexus.github.io/pagy/docs/extras/standalone
192
+ # require 'pagy/extras/standalone'
193
+ # Pagy::DEFAULT[:url] = 'http://www.example.com/subdir' # optional default
115
194
 
116
195
  # Rails
117
-
118
- # Rails: extras assets path required by the helpers that use javascript
196
+ # Enable the .js file required by the helpers that use javascript
119
197
  # (pagy*_nav_js, pagy*_combo_nav_js, and pagy_items_selector_js)
120
- # See https://ddnexus.github.io/pagy/extras#javascript
198
+ # See https://ddnexus.github.io/pagy/docs/api/javascript
199
+
200
+ # With the asset pipeline
201
+ # Sprockets need to look into the pagy javascripts dir, so add it to the assets paths
121
202
  # Rails.application.config.assets.paths << Pagy.root.join('javascripts')
122
203
 
123
204
  # I18n
124
205
 
125
206
  # Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem
126
- # See https://ddnexus.github.io/pagy/api/frontend#i18n
207
+ # See https://ddnexus.github.io/pagy/docs/api/i18n
127
208
  # Notice: No need to configure anything in this section if your app uses only "en"
128
209
  # or if you use the i18n extra below
129
210
  #
@@ -136,23 +217,26 @@ Pagy::VARS[:items] = 10 # default
136
217
  #
137
218
  # load the "de", "en" and "es" built-in locales:
138
219
  # (the first passed :locale will be used also as the default_locale)
139
- # Pagy::I18n.load({locale: 'de'},
140
- # {locale: 'en'},
141
- # {locale: 'es'})
220
+ # Pagy::I18n.load({ locale: 'de' },
221
+ # { locale: 'en' },
222
+ # { locale: 'es' })
142
223
  #
143
224
  # load the "en" built-in locale, a custom "es" locale,
144
225
  # and a totally custom locale complete with a custom :pluralize proc:
145
226
  # (the first passed :locale will be used also as the default_locale)
146
- # Pagy::I18n.load({locale: 'en'},
147
- # {locale: 'es', filepath: 'path/to/pagy-es.yml'},
148
- # {locale: 'xyz', # not built-in
149
- # filepath: 'path/to/pagy-xyz.yml',
150
- # pluralize: lambda{|count| ... } )
227
+ # Pagy::I18n.load({ locale: 'en' },
228
+ # { locale: 'es', filepath: 'path/to/pagy-es.yml' },
229
+ # { locale: 'xyz', # not built-in
230
+ # filepath: 'path/to/pagy-xyz.yml',
231
+ # pluralize: lambda{ |count| ... } )
151
232
 
152
233
  # I18n extra: uses the standard i18n gem which is ~18x slower using ~10x more memory
153
234
  # than the default pagy internal i18n (see above)
154
- # See https://ddnexus.github.io/pagy/extras/i18n
235
+ # See https://ddnexus.github.io/pagy/docs/extras/i18n
155
236
  # require 'pagy/extras/i18n'
156
237
 
157
238
  # Default i18n key
158
- # Pagy::VARS[:i18n_key] = 'pagy.item_name' # default
239
+ # Pagy::DEFAULT[:i18n_key] = 'pagy.item_name' # default
240
+
241
+ # When you are done setting your own default freeze it, so it will not get changed accidentally
242
+ Pagy::DEFAULT.freeze
@@ -0,0 +1,178 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "simple_form"
4
+
5
+ # Uncomment this and change the path if necessary to include your own
6
+ # components.
7
+ # See https://github.com/heartcombo/simple_form#custom-components to know
8
+ # more about custom components.
9
+ # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
10
+ #
11
+ # Use this setup block to configure all options available in SimpleForm.
12
+ SimpleForm.setup do |config|
13
+ # Wrappers are used by the form builder to generate a
14
+ # complete input. You can remove any component from the
15
+ # wrapper, change the order or even add your own to the
16
+ # stack. The options given below are used to wrap the
17
+ # whole input.
18
+ config.wrappers :default, class: :input,
19
+ hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b|
20
+ ## Extensions enabled by default
21
+ # Any of these extensions can be disabled for a
22
+ # given input by passing: `f.input EXTENSION_NAME => false`.
23
+ # You can make any of these extensions optional by
24
+ # renaming `b.use` to `b.optional`.
25
+
26
+ # Determines whether to use HTML5 (:email, :url, ...)
27
+ # and required attributes
28
+ b.use :html5
29
+
30
+ # Calculates placeholders automatically from I18n
31
+ # You can also pass a string as f.input placeholder: "Placeholder"
32
+ b.use :placeholder
33
+
34
+ ## Optional extensions
35
+ # They are disabled unless you pass `f.input EXTENSION_NAME => true`
36
+ # to the input. If so, they will retrieve the values from the model
37
+ # if any exists. If you want to enable any of those
38
+ # extensions by default, you can change `b.optional` to `b.use`.
39
+
40
+ # Calculates maxlength from length validations for string inputs
41
+ # and/or database column lengths
42
+ b.optional :maxlength
43
+
44
+ # Calculate minlength from length validations for string inputs
45
+ b.optional :minlength
46
+
47
+ # Calculates pattern from format validations for string inputs
48
+ b.optional :pattern
49
+
50
+ # Calculates min and max from length validations for numeric inputs
51
+ b.optional :min_max
52
+
53
+ # Calculates readonly automatically from readonly attributes
54
+ b.optional :readonly
55
+
56
+ ## Inputs
57
+ # b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid'
58
+ b.use :label_input
59
+ b.use :hint, wrap_with: {tag: :span, class: :hint}
60
+ b.use :error, wrap_with: {tag: :span, class: :error}
61
+
62
+ ## full_messages_for
63
+ # If you want to display the full error message for the attribute, you can
64
+ # use the component :full_error, like:
65
+ #
66
+ # b.use :full_error, wrap_with: { tag: :span, class: :error }
67
+ end
68
+
69
+ # The default wrapper to be used by the FormBuilder.
70
+ config.default_wrapper = :default
71
+
72
+ # Define the way to render check boxes / radio buttons with labels.
73
+ # Defaults to :nested for bootstrap config.
74
+ # inline: input + label
75
+ # nested: label > input
76
+ config.boolean_style = :nested
77
+
78
+ # Default class for buttons
79
+ config.button_class = "btn"
80
+
81
+ # Method used to tidy up errors. Specify any Rails Array method.
82
+ # :first lists the first message for each field.
83
+ # Use :to_sentence to list all errors for each field.
84
+ # config.error_method = :first
85
+
86
+ # Default tag used for error notification helper.
87
+ config.error_notification_tag = :div
88
+
89
+ # CSS class to add for error notification helper.
90
+ config.error_notification_class = "error_notification"
91
+
92
+ # Series of attempts to detect a default label method for collection.
93
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
94
+
95
+ # Series of attempts to detect a default value method for collection.
96
+ # config.collection_value_methods = [ :id, :to_s ]
97
+
98
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
99
+ # config.collection_wrapper_tag = nil
100
+
101
+ # You can define the class to use on all collection wrappers. Defaulting to none.
102
+ # config.collection_wrapper_class = nil
103
+
104
+ # You can wrap each item in a collection of radio/check boxes with a tag,
105
+ # defaulting to :span.
106
+ # config.item_wrapper_tag = :span
107
+
108
+ # You can define a class to use in all item wrappers. Defaulting to none.
109
+ # config.item_wrapper_class = nil
110
+
111
+ # How the label text should be generated altogether with the required text.
112
+ # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
113
+
114
+ # You can define the class to use on all labels. Default is nil.
115
+ # config.label_class = nil
116
+
117
+ # You can define the default class to be used on forms. Can be overridden
118
+ # with `html: { :class }`. Defaulting to none.
119
+ # config.default_form_class = nil
120
+
121
+ # You can define which elements should obtain additional classes
122
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
123
+
124
+ # Whether attributes are required by default (or not). Default is true.
125
+ # config.required_by_default = true
126
+
127
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
128
+ # These validations are enabled in SimpleForm's internal config but disabled by default
129
+ # in this configuration, which is recommended due to some quirks from different browsers.
130
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
131
+ # change this configuration to true.
132
+ config.browser_validations = false
133
+
134
+ # Custom mappings for input types. This should be a hash containing a regexp
135
+ # to match as key, and the input type that will be used when the field name
136
+ # matches the regexp as value.
137
+ # config.input_mappings = { /count/ => :integer }
138
+
139
+ # Custom wrappers for input types. This should be a hash containing an input
140
+ # type as key and the wrapper that will be used for all inputs with specified type.
141
+ # config.wrapper_mappings = { string: :prepend }
142
+
143
+ # Namespaces where SimpleForm should look for custom input classes that
144
+ # override default inputs.
145
+ # config.custom_inputs_namespaces << "CustomInputs"
146
+
147
+ # Default priority for time_zone inputs.
148
+ # config.time_zone_priority = nil
149
+
150
+ # Default priority for country inputs.
151
+ # config.country_priority = nil
152
+
153
+ # When false, do not use translations for labels.
154
+ # config.translate_labels = true
155
+
156
+ # Automatically discover new inputs in Rails' autoload path.
157
+ # config.inputs_discovery = true
158
+
159
+ # Cache SimpleForm inputs discovery
160
+ # config.cache_discovery = !Rails.env.development?
161
+
162
+ # Default class for inputs
163
+ # config.input_class = nil
164
+
165
+ # Define the default class of the input wrapper of the boolean input.
166
+ config.boolean_label_class = "checkbox"
167
+
168
+ # Defines if the default input wrapper class should be included in radio
169
+ # collection wrappers.
170
+ # config.include_default_input_wrapper_class = true
171
+
172
+ # Defines which i18n scope will be used in Simple Form.
173
+ # config.i18n_scope = 'simple_form'
174
+
175
+ # Defines validation classes to the input_field. By default it's nil.
176
+ # config.input_field_valid_class = 'is-valid'
177
+ # config.input_field_error_class = 'is-invalid'
178
+ end