geoblacklight_admin 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/geoblacklight_admin/_core.scss +1 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_pagy.scss +7 -0
- data/app/controllers/concerns/blacklight/catalog.rb +373 -0
- data/app/helpers/facets_helper.rb +19 -0
- data/app/views/admin/document_data_dictionaries/new.html.erb +2 -2
- data/app/views/catalog/_facet_pagination.html.erb +6 -0
- data/app/views/catalog/_paginate_compact.html.erb +9 -0
- data/app/views/catalog/_results_pagination.html.erb +9 -0
- data/lib/generators/geoblacklight_admin/config_generator.rb +1 -1
- data/lib/generators/geoblacklight_admin/templates/config/initializers/pagy.rb +53 -83
- data/lib/geoblacklight_admin/engine.rb +1 -0
- data/lib/geoblacklight_admin/version.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3206d757d63794d306ce29d80d7bcf7ea9e2afe7f94f21792885a71e3edc9ac6
|
4
|
+
data.tar.gz: 1916a1e90a1826bb509a497b6bab3c4f3253e44cac7f44f73e6f676638c78f91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09f174737d687d2a9d60a9a5a6fb73d11eefaf160ec2862a2ff0d12e4b926ab8b0b91d534ae4b20d781319b1b50107dd05cb214c54ffdc6c531bb600ca139c5b'
|
7
|
+
data.tar.gz: af6d3f3e20943a2a8de0a1020d0a568e2870738c5c74d21ef9aad575fd9364360c620e78c2d16cead8261f77501c8a05c095ea94747801be4a63b81e3421af0e
|
@@ -0,0 +1,373 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight::Catalog
|
4
|
+
include Pagy::Backend
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
# MimeResponds is part of ActionController::Base, but not ActionController::API
|
8
|
+
include ActionController::MimeResponds
|
9
|
+
|
10
|
+
Deprecation.silence(Blacklight::Base) do
|
11
|
+
include Blacklight::Base
|
12
|
+
end
|
13
|
+
|
14
|
+
include Blacklight::Facet
|
15
|
+
include Blacklight::Searchable
|
16
|
+
|
17
|
+
extend Deprecation
|
18
|
+
|
19
|
+
# The following code is executed when someone includes blacklight::catalog in their
|
20
|
+
# own controller.
|
21
|
+
included do
|
22
|
+
if respond_to? :helper_method
|
23
|
+
helper_method :sms_mappings, :has_search_parameters?, :facet_limit_for
|
24
|
+
end
|
25
|
+
|
26
|
+
helper Blacklight::Facet if respond_to? :helper
|
27
|
+
|
28
|
+
# The index action will more than likely throw this one.
|
29
|
+
# Example: when the standard query parser is used, and a user submits a "bad" query.
|
30
|
+
rescue_from Blacklight::Exceptions::InvalidRequest, with: :handle_request_error
|
31
|
+
|
32
|
+
record_search_parameters
|
33
|
+
end
|
34
|
+
|
35
|
+
# get search results from the solr index
|
36
|
+
def index
|
37
|
+
(@response, deprecated_document_list) = search_service.search_results
|
38
|
+
|
39
|
+
@document_list = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(
|
40
|
+
deprecated_document_list,
|
41
|
+
"The @document_list instance variable is deprecated; use @response.documents instead.",
|
42
|
+
ActiveSupport::Deprecation.new("8.0", "blacklight")
|
43
|
+
)
|
44
|
+
|
45
|
+
@pagy = Pagy.new(
|
46
|
+
count: @response.total_count,
|
47
|
+
page: params[:page],
|
48
|
+
limit: params[:per_page]
|
49
|
+
)
|
50
|
+
|
51
|
+
respond_to do |format|
|
52
|
+
format.html { store_preferred_view }
|
53
|
+
format.rss { render layout: false }
|
54
|
+
format.atom { render layout: false }
|
55
|
+
format.json do
|
56
|
+
@presenter = Blacklight::JsonPresenter.new(@response,
|
57
|
+
blacklight_config)
|
58
|
+
end
|
59
|
+
additional_response_formats(format)
|
60
|
+
document_export_formats(format)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# get a single document from the index
|
65
|
+
# to add responses for formats other than html or json see _Blacklight::Document::Export_
|
66
|
+
def show
|
67
|
+
deprecated_response, @document = search_service.fetch(params[:id])
|
68
|
+
@response = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(
|
69
|
+
deprecated_response,
|
70
|
+
"The @response instance variable is deprecated; use @document.response instead.",
|
71
|
+
ActiveSupport::Deprecation.new("8.0", "blacklight")
|
72
|
+
)
|
73
|
+
|
74
|
+
respond_to do |format|
|
75
|
+
format.html { @search_context = setup_next_and_previous_documents }
|
76
|
+
format.json
|
77
|
+
additional_export_formats(@document, format)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def advanced_search
|
82
|
+
(@response, _deprecated_document_list) = blacklight_advanced_search_form_search_service.search_results
|
83
|
+
end
|
84
|
+
|
85
|
+
# get a single document from the index
|
86
|
+
def raw
|
87
|
+
raise(ActionController::RoutingError, "Not Found") unless blacklight_config.raw_endpoint.enabled
|
88
|
+
|
89
|
+
_, @document = search_service.fetch(params[:id])
|
90
|
+
render json: @document
|
91
|
+
end
|
92
|
+
|
93
|
+
# updates the search counter (allows the show view to paginate)
|
94
|
+
def track
|
95
|
+
search_session["counter"] = params[:counter]
|
96
|
+
search_session["id"] = params[:search_id]
|
97
|
+
search_session["per_page"] = params[:per_page]
|
98
|
+
search_session["document_id"] = params[:document_id]
|
99
|
+
|
100
|
+
if params[:redirect] && (params[:redirect].starts_with?("/") || params[:redirect] =~ URI::DEFAULT_PARSER.make_regexp)
|
101
|
+
uri = URI.parse(params[:redirect])
|
102
|
+
path = uri.query ? "#{uri.path}?#{uri.query}" : uri.path
|
103
|
+
redirect_to path, status: :see_other
|
104
|
+
else
|
105
|
+
redirect_to({action: :show, id: params[:id]}, status: :see_other)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# displays values and pagination links for a single facet field
|
110
|
+
def facet
|
111
|
+
@facet = blacklight_config.facet_fields[params[:id]]
|
112
|
+
raise ActionController::RoutingError, "Not Found" unless @facet
|
113
|
+
|
114
|
+
@response = search_service.facet_field_response(@facet.key)
|
115
|
+
@display_facet = @response.aggregations[@facet.field]
|
116
|
+
|
117
|
+
@presenter = (@facet.presenter || Blacklight::FacetFieldPresenter).new(@facet, @display_facet, view_context)
|
118
|
+
@pagination = @presenter.paginator
|
119
|
+
|
120
|
+
@pagy = Pagy.new(
|
121
|
+
count: @response.total_count,
|
122
|
+
page_param: "facet.page",
|
123
|
+
page: params["facet.page"],
|
124
|
+
limit: 20
|
125
|
+
)
|
126
|
+
|
127
|
+
respond_to do |format|
|
128
|
+
format.html do
|
129
|
+
# Draw the partial for the "more" facet modal window:
|
130
|
+
return render layout: false if request.xhr?
|
131
|
+
# Otherwise draw the facet selector for users who have javascript disabled.
|
132
|
+
end
|
133
|
+
format.json
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# method to serve up XML OpenSearch description and JSON autocomplete response
|
138
|
+
def opensearch
|
139
|
+
respond_to do |format|
|
140
|
+
format.xml { render layout: false }
|
141
|
+
format.json { render json: search_service.opensearch_response }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def suggest
|
146
|
+
respond_to do |format|
|
147
|
+
format.json do
|
148
|
+
render json: suggestions_service.suggestions
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# @return [Array] first value is a Blacklight::Solr::Response and the second
|
154
|
+
# is a list of documents
|
155
|
+
def action_documents
|
156
|
+
deprecated_response, @documents = search_service.fetch(Array(params[:id]))
|
157
|
+
raise Blacklight::Exceptions::RecordNotFound if @documents.blank?
|
158
|
+
|
159
|
+
[deprecated_response, @documents]
|
160
|
+
end
|
161
|
+
|
162
|
+
def action_success_redirect_path
|
163
|
+
search_state.url_for_document(blacklight_config.document_model.new(id: params[:id]))
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# Check if any search parameters have been set
|
168
|
+
# @return [Boolean]
|
169
|
+
def has_search_parameters?
|
170
|
+
params[:search_field].present? || search_state.has_constraints?
|
171
|
+
end
|
172
|
+
|
173
|
+
# TODO: deprecate this constant with #facet_limit_for
|
174
|
+
DEFAULT_FACET_LIMIT = 10
|
175
|
+
|
176
|
+
# Look up facet limit for given facet_field. Will look at config, and
|
177
|
+
# if config is 'true' will look up from Solr @response if available. If
|
178
|
+
# no limit is available, returns nil. Used from #add_facetting_to_solr
|
179
|
+
# to supply f.fieldname.facet.limit values in solr request (no @response
|
180
|
+
# available), and used in display (with @response available) to create
|
181
|
+
# a facet paginator with the right limit.
|
182
|
+
def facet_limit_for(facet_field)
|
183
|
+
facet = blacklight_config.facet_fields[facet_field]
|
184
|
+
return if facet.blank?
|
185
|
+
|
186
|
+
if facet.limit && @response && @response.aggregations[facet.field]
|
187
|
+
limit = @response.aggregations[facet.field].limit
|
188
|
+
|
189
|
+
if limit.nil? # we didn't get or a set a limit, so infer one.
|
190
|
+
facet.limit if facet.limit != true
|
191
|
+
elsif limit == -1 # limit -1 is solr-speak for unlimited
|
192
|
+
nil
|
193
|
+
else
|
194
|
+
limit.to_i - 1 # we added 1 to find out if we needed to paginate
|
195
|
+
end
|
196
|
+
elsif facet.limit
|
197
|
+
(facet.limit == true) ? DEFAULT_FACET_LIMIT : facet.limit
|
198
|
+
end
|
199
|
+
end
|
200
|
+
deprecation_deprecate facet_limit_for: "moving to private logic in Blacklight::FacetFieldPresenter"
|
201
|
+
|
202
|
+
private
|
203
|
+
|
204
|
+
#
|
205
|
+
# non-routable methods ->
|
206
|
+
#
|
207
|
+
|
208
|
+
def render_sms_action?(_config, _options)
|
209
|
+
sms_mappings.present?
|
210
|
+
end
|
211
|
+
|
212
|
+
##
|
213
|
+
# If the params specify a view, then store it in the session. If the params
|
214
|
+
# do not specifiy the view, set the view parameter to the value stored in the
|
215
|
+
# session. This enables a user with a session to do subsequent searches and have
|
216
|
+
# them default to the last used view.
|
217
|
+
def store_preferred_view
|
218
|
+
session[:preferred_view] = params[:view] if params[:view]
|
219
|
+
end
|
220
|
+
|
221
|
+
##
|
222
|
+
# Render additional response formats for the index action, as provided by the
|
223
|
+
# blacklight configuration
|
224
|
+
# @param [Hash] format
|
225
|
+
# @note Make sure your format has a well known mime-type or is registered in config/initializers/mime_types.rb
|
226
|
+
# @example
|
227
|
+
# config.index.respond_to.txt = Proc.new { render plain: "A list of docs." }
|
228
|
+
def additional_response_formats(format)
|
229
|
+
blacklight_config.view_config(action_name: :index).respond_to.each do |key, config|
|
230
|
+
format.send key do
|
231
|
+
case config
|
232
|
+
when false
|
233
|
+
raise ActionController::RoutingError, "Not Found"
|
234
|
+
when Hash
|
235
|
+
render config
|
236
|
+
when Proc
|
237
|
+
instance_exec(&config)
|
238
|
+
when Symbol, String
|
239
|
+
send config
|
240
|
+
else
|
241
|
+
render({})
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
##
|
248
|
+
# Render additional export formats for the show action, as provided by
|
249
|
+
# the document extension framework. See _Blacklight::Document::Export_
|
250
|
+
def additional_export_formats(document, format)
|
251
|
+
document.export_formats.each_key do |format_name|
|
252
|
+
format.send(format_name.to_sym) { render body: document.export_as(format_name), layout: false }
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
##
|
257
|
+
# Try to render a response from the document export formats available
|
258
|
+
def document_export_formats(format)
|
259
|
+
format.any do
|
260
|
+
format_name = params.fetch(:format, "").to_sym
|
261
|
+
if @response.export_formats.include? format_name
|
262
|
+
render_document_export_format format_name
|
263
|
+
else
|
264
|
+
raise ActionController::UnknownFormat
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
##
|
270
|
+
# Render the document export formats for a response
|
271
|
+
# First, try to render an appropriate template (e.g. index.endnote.erb)
|
272
|
+
# If that fails, just concatenate the document export responses with a newline.
|
273
|
+
def render_document_export_format format_name
|
274
|
+
render
|
275
|
+
rescue ActionView::MissingTemplate
|
276
|
+
render plain: @response.documents.map { |x| x.export_as(format_name) if x.exports_as? format_name }.compact.join("\n"), layout: false
|
277
|
+
end
|
278
|
+
|
279
|
+
# Overrides the Blacklight::Controller provided #search_action_url.
|
280
|
+
# By default, any search action from a Blacklight::Catalog controller
|
281
|
+
# should use the current controller when constructing the route.
|
282
|
+
def search_action_url options = {}
|
283
|
+
options = options.to_h if options.is_a? Blacklight::SearchState
|
284
|
+
url_for(options.reverse_merge(action: "index"))
|
285
|
+
end
|
286
|
+
|
287
|
+
# Email Action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
|
288
|
+
def email_action documents
|
289
|
+
mail = RecordMailer.email_record(documents, {to: params[:to], message: params[:message], config: blacklight_config}, url_options)
|
290
|
+
if mail.respond_to? :deliver_now
|
291
|
+
mail.deliver_now
|
292
|
+
else
|
293
|
+
mail.deliver
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
# SMS action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
|
298
|
+
def sms_action documents
|
299
|
+
to = "#{params[:to].gsub(/[^\d]/, "")}@#{params[:carrier]}"
|
300
|
+
mail = RecordMailer.sms_record(documents, {to: to, config: blacklight_config}, url_options)
|
301
|
+
if mail.respond_to? :deliver_now
|
302
|
+
mail.deliver_now
|
303
|
+
else
|
304
|
+
mail.deliver
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
def validate_sms_params
|
309
|
+
if params[:to].blank?
|
310
|
+
flash[:error] = I18n.t("blacklight.sms.errors.to.blank")
|
311
|
+
elsif params[:carrier].blank?
|
312
|
+
flash[:error] = I18n.t("blacklight.sms.errors.carrier.blank")
|
313
|
+
elsif params[:to].gsub(/[^\d]/, "").length != 10
|
314
|
+
flash[:error] = I18n.t("blacklight.sms.errors.to.invalid", to: params[:to])
|
315
|
+
elsif !sms_mappings.value?(params[:carrier])
|
316
|
+
flash[:error] = I18n.t("blacklight.sms.errors.carrier.invalid")
|
317
|
+
end
|
318
|
+
|
319
|
+
flash[:error].blank?
|
320
|
+
end
|
321
|
+
|
322
|
+
def sms_mappings
|
323
|
+
Blacklight::Engine.config.blacklight.sms_mappings
|
324
|
+
end
|
325
|
+
|
326
|
+
def validate_email_params
|
327
|
+
if params[:to].blank?
|
328
|
+
flash[:error] = I18n.t("blacklight.email.errors.to.blank")
|
329
|
+
elsif !params[:to].match(Blacklight::Engine.config.blacklight.email_regexp)
|
330
|
+
flash[:error] = I18n.t("blacklight.email.errors.to.invalid", to: params[:to])
|
331
|
+
end
|
332
|
+
|
333
|
+
flash[:error].blank?
|
334
|
+
end
|
335
|
+
|
336
|
+
def start_new_search_session?
|
337
|
+
action_name == "index"
|
338
|
+
end
|
339
|
+
|
340
|
+
def determine_layout
|
341
|
+
(action_name == "show") ? "catalog_result" : super
|
342
|
+
end
|
343
|
+
|
344
|
+
# when a method throws a Blacklight::Exceptions::InvalidRequest, this method is executed.
|
345
|
+
def handle_request_error(exception)
|
346
|
+
# Rails own code will catch and give usual Rails error page with stack trace
|
347
|
+
raise exception if Rails.env.development? || Rails.env.test?
|
348
|
+
|
349
|
+
flash_notice = I18n.t("blacklight.search.errors.request_error")
|
350
|
+
|
351
|
+
# If there are errors coming from the index page, we want to trap those sensibly
|
352
|
+
|
353
|
+
if flash[:notice] == flash_notice
|
354
|
+
logger&.error "Cowardly aborting rsolr_request_error exception handling, because we redirected to a page that raises another exception"
|
355
|
+
raise exception
|
356
|
+
end
|
357
|
+
|
358
|
+
logger&.error exception
|
359
|
+
|
360
|
+
flash[:notice] = flash_notice
|
361
|
+
redirect_to search_action_url
|
362
|
+
end
|
363
|
+
|
364
|
+
def blacklight_advanced_search_form_search_service
|
365
|
+
form_search_state = search_state_class.new(blacklight_advanced_search_form_params, blacklight_config, self)
|
366
|
+
|
367
|
+
search_service_class.new(config: blacklight_config, search_state: form_search_state, user_params: form_search_state.to_h, **search_service_context)
|
368
|
+
end
|
369
|
+
|
370
|
+
def blacklight_advanced_search_form_params
|
371
|
+
{}
|
372
|
+
end
|
373
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FacetsHelper
|
4
|
+
def local_facet_sort_buttons(facet_field)
|
5
|
+
content_tag(:div, class: "sort-options btn-group") do
|
6
|
+
if params["facet.sort"] == "index"
|
7
|
+
content_tag(:span, "A-Z Sort", class: "active az btn btn-outline-secondary", data: {blacklight_modal: "preserve"}) +
|
8
|
+
link_to("Numerical Sort", facet_sort_url("count", facet_field), class: "sort_change numeric btn btn-outline-secondary", data: {blacklight_modal: "preserve"})
|
9
|
+
else
|
10
|
+
link_to("A-Z Sort", facet_sort_url("index", facet_field), class: "sort_change az btn btn-outline-secondary", data: {blacklight_modal: "preserve"}) +
|
11
|
+
content_tag(:span, "Numerical Sort", class: "active numeric btn btn-outline-secondary")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def facet_sort_url(sort_type, facet_field)
|
17
|
+
url_for(request.query_parameters.merge(:controller => "catalog", :action => "facet", "facet_field" => facet_field, "facet.sort" => sort_type))
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<div class="prev_next_links btn-group pagy">
|
2
|
+
<%== pagy_prev_a(@pagy, text: "« Previous", anchor_string: 'class="btn btn-link" data-blacklight-modal="preserve" rel="prev"') %>
|
3
|
+
<%== pagy_next_a(@pagy, text: "Next »", anchor_string: 'class="btn btn-link" data-blacklight-modal="preserve" rel="next"') %>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<%= local_facet_sort_buttons(@display_facet.name) %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% if @pagy.pages > 1 %>
|
2
|
+
<section class="pagination">
|
3
|
+
<div class="page-links">
|
4
|
+
<%== pagy_prev_a(@pagy, text: "« Previous") %>
|
5
|
+
<%= " | <strong>#{number_with_delimiter(@pagy.from)} - #{number_with_delimiter(@pagy.to)}</strong> of <strong>#{number_with_delimiter(@pagy.count)}</strong> | ".html_safe %>
|
6
|
+
<%== pagy_next_a(@pagy, text: "Next »") %>
|
7
|
+
</div>
|
8
|
+
</section>
|
9
|
+
<% end %>
|
@@ -420,7 +420,7 @@ module GeoblacklightAdmin
|
|
420
420
|
|
421
421
|
def add_show_gbl_admin_data_dictionaries
|
422
422
|
inject_into_file "app/controllers/catalog_controller.rb", after: "# Custom tools for GeoBlacklight" do
|
423
|
-
"\n
|
423
|
+
"\n config.add_show_tools_partial :gbl_admin_data_dictionaries, partial: 'gbl_admin_data_dictionaries', if: proc { |_context, _config, options| options[:document] && options[:document]&.kithe_model&.document_data_dictionaries&.present? }"
|
424
424
|
end
|
425
425
|
end
|
426
426
|
|
@@ -1,37 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
# Pagy initializer file (6.0.4)
|
3
|
+
# Pagy initializer file (9.3.3)
|
6
4
|
# Customize only what you really need and notice that the core Pagy works also without any of the following lines.
|
7
5
|
# Should you just cherry pick part of this file, please maintain the require-order of the extras
|
8
6
|
|
9
|
-
# Pagy
|
7
|
+
# Pagy Variables
|
10
8
|
# See https://ddnexus.github.io/pagy/docs/api/pagy#variables
|
11
|
-
#
|
9
|
+
# You can set any pagy variable as a Pagy::DEFAULT. They can also be overridden per instance by just passing them to
|
12
10
|
# Pagy.new|Pagy::Countless.new|Pagy::Calendar::*.new or any of the #pagy* controller methods
|
13
|
-
|
14
|
-
#
|
15
|
-
#
|
16
|
-
# Pagy::DEFAULT[:
|
17
|
-
# Pagy::DEFAULT[:
|
18
|
-
# Pagy::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
|
11
|
+
# Here are the few that make more sense as DEFAULTs:
|
12
|
+
# Pagy::DEFAULT[:limit] = 20 # default
|
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
|
31
18
|
|
32
19
|
# Extras
|
33
20
|
# See https://ddnexus.github.io/pagy/categories/extra
|
34
21
|
|
22
|
+
# Legacy Compatibility Extras
|
23
|
+
|
24
|
+
# Size extra: Enable the Array type for the `:size` variable (e.g. `size: [1,4,4,1]`)
|
25
|
+
# See https://ddnexus.github.io/pagy/docs/extras/size
|
26
|
+
# require 'pagy/extras/size' # must be required before the other extras
|
27
|
+
|
35
28
|
# Backend Extras
|
36
29
|
|
37
30
|
# Arel extra: For better performance utilizing grouped ActiveRecord collections:
|
@@ -45,21 +38,12 @@ require "pagy"
|
|
45
38
|
# Calendar extra: Add pagination filtering by calendar time unit (year, quarter, month, week, day)
|
46
39
|
# See https://ddnexus.github.io/pagy/docs/extras/calendar
|
47
40
|
# require 'pagy/extras/calendar'
|
48
|
-
# Default for each unit
|
49
|
-
# Pagy::Calendar::Year::DEFAULT
|
50
|
-
# Pagy::Calendar::
|
51
|
-
#
|
52
|
-
# Pagy::Calendar::
|
53
|
-
# Pagy::Calendar::
|
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
|
41
|
+
# Default for each calendar unit class in IRB:
|
42
|
+
# >> Pagy::Calendar::Year::DEFAULT
|
43
|
+
# >> Pagy::Calendar::Quarter::DEFAULT
|
44
|
+
# >> Pagy::Calendar::Month::DEFAULT
|
45
|
+
# >> Pagy::Calendar::Week::DEFAULT
|
46
|
+
# >> Pagy::Calendar::Day::DEFAULT
|
63
47
|
#
|
64
48
|
# Uncomment the following lines, if you need calendar localization without using the I18n extra
|
65
49
|
# module LocalizePagyCalendar
|
@@ -84,13 +68,17 @@ require "pagy"
|
|
84
68
|
# require 'pagy/extras/elasticsearch_rails'
|
85
69
|
|
86
70
|
# Headers extra: http response headers (and other helpers) useful for API pagination
|
87
|
-
# See
|
71
|
+
# See https://ddnexus.github.io/pagy/docs/extras/headers
|
88
72
|
# require 'pagy/extras/headers'
|
89
73
|
# Pagy::DEFAULT[:headers] = { page: 'Current-Page',
|
90
|
-
#
|
74
|
+
# limit: 'Page-Items',
|
91
75
|
# count: 'Total-Count',
|
92
76
|
# pages: 'Total-Pages' } # default
|
93
77
|
|
78
|
+
# Keyset extra: Paginate with the Pagy keyset pagination technique
|
79
|
+
# See https://ddnexus.github.io/pagy/docs/extras/keyset
|
80
|
+
# require 'pagy/extras/keyset'
|
81
|
+
|
94
82
|
# Meilisearch extra: Paginate `Meilisearch` result objects
|
95
83
|
# See https://ddnexus.github.io/pagy/docs/extras/meilisearch
|
96
84
|
# Default :pagy_search method: change only if you use also
|
@@ -102,8 +90,8 @@ require "pagy"
|
|
102
90
|
|
103
91
|
# Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
|
104
92
|
# See https://ddnexus.github.io/pagy/docs/extras/metadata
|
105
|
-
# you must require the
|
106
|
-
# require 'pagy/extras/
|
93
|
+
# you must require the JS Tools internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
|
94
|
+
# require 'pagy/extras/js_tools'
|
107
95
|
# require 'pagy/extras/metadata'
|
108
96
|
# For performance reasons, you should explicitly set ONLY the metadata you use in the frontend
|
109
97
|
# Pagy::DEFAULT[:metadata] = %i[scaffold_url page prev next last] # example
|
@@ -112,7 +100,7 @@ require "pagy"
|
|
112
100
|
# See https://ddnexus.github.io/pagy/docs/extras/searchkick
|
113
101
|
# Default :pagy_search method: change only if you use also
|
114
102
|
# the elasticsearch_rails or meilisearch extra that defines the same
|
115
|
-
# DEFAULT[:searchkick_pagy_search] = :pagy_search
|
103
|
+
# Pagy::DEFAULT[:searchkick_pagy_search] = :pagy_search
|
116
104
|
# Default original :search method called internally to do the actual search
|
117
105
|
# Pagy::DEFAULT[:searchkick_search] = :search
|
118
106
|
# require 'pagy/extras/searchkick'
|
@@ -129,58 +117,37 @@ require "pagy/extras/bootstrap"
|
|
129
117
|
# See https://ddnexus.github.io/pagy/docs/extras/bulma
|
130
118
|
# require 'pagy/extras/bulma'
|
131
119
|
|
132
|
-
#
|
133
|
-
#
|
134
|
-
#
|
135
|
-
|
136
|
-
# Materialize extra: Add nav, nav_js and combo_nav_js helpers for Materialize pagination
|
137
|
-
# See https://ddnexus.github.io/pagy/docs/extras/materialize
|
138
|
-
# require 'pagy/extras/materialize'
|
139
|
-
|
140
|
-
# Navs extra: Add nav_js and combo_nav_js javascript helpers
|
141
|
-
# Notice: the other frontend extras add their own framework-styled versions,
|
142
|
-
# so require this extra only if you need the unstyled version
|
143
|
-
# See https://ddnexus.github.io/pagy/docs/extras/navs
|
144
|
-
# require 'pagy/extras/navs'
|
145
|
-
|
146
|
-
# Semantic extra: Add nav, nav_js and combo_nav_js helpers for Semantic UI pagination
|
147
|
-
# See https://ddnexus.github.io/pagy/docs/extras/semantic
|
148
|
-
# require 'pagy/extras/semantic'
|
149
|
-
|
150
|
-
# UIkit extra: Add nav helper and templates for UIkit pagination
|
151
|
-
# See https://ddnexus.github.io/pagy/docs/extras/uikit
|
152
|
-
# require 'pagy/extras/uikit'
|
120
|
+
# Pagy extra: Add the pagy styled versions of the javascript-powered navs
|
121
|
+
# and a few other components to the Pagy::Frontend module.
|
122
|
+
# See https://ddnexus.github.io/pagy/docs/extras/pagy
|
123
|
+
require "pagy/extras/pagy"
|
153
124
|
|
154
125
|
# Multi size var used by the *_nav_js helpers
|
155
|
-
# See https://ddnexus.github.io/pagy/docs/extras/
|
156
|
-
# Pagy::DEFAULT[:steps] = { 0 =>
|
126
|
+
# See https://ddnexus.github.io/pagy/docs/extras/pagy#steps
|
127
|
+
# Pagy::DEFAULT[:steps] = { 0 => 5, 540 => 7, 720 => 9 } # example
|
157
128
|
|
158
129
|
# Feature Extras
|
159
130
|
|
160
|
-
# Gearbox extra: Automatically change the
|
131
|
+
# Gearbox extra: Automatically change the limit per page depending on the page number
|
161
132
|
# See https://ddnexus.github.io/pagy/docs/extras/gearbox
|
162
133
|
# require 'pagy/extras/gearbox'
|
163
134
|
# set to false only if you want to make :gearbox_extra an opt-in variable
|
164
135
|
# Pagy::DEFAULT[:gearbox_extra] = false # default true
|
165
|
-
# Pagy::DEFAULT[:
|
136
|
+
# Pagy::DEFAULT[:gearbox_limit] = [15, 30, 60, 100] # default
|
166
137
|
|
167
|
-
#
|
168
|
-
# See https://ddnexus.github.io/pagy/docs/extras/
|
169
|
-
|
170
|
-
# set to false only if you want to make :
|
171
|
-
# Pagy::DEFAULT[:
|
172
|
-
# Pagy::DEFAULT[:
|
173
|
-
|
138
|
+
# Limit extra: Allow the client to request a custom limit per page with an optional selector UI
|
139
|
+
# See https://ddnexus.github.io/pagy/docs/extras/limit
|
140
|
+
require "pagy/extras/limit"
|
141
|
+
# set to false only if you want to make :limit_extra an opt-in variable
|
142
|
+
# Pagy::DEFAULT[:limit_extra] = false # default true
|
143
|
+
# Pagy::DEFAULT[:limit_param] = :limit # default
|
144
|
+
Pagy::DEFAULT[:limit_max] = 100 # default
|
174
145
|
|
175
146
|
# Overflow extra: Allow for easy handling of overflowing pages
|
176
147
|
# See https://ddnexus.github.io/pagy/docs/extras/overflow
|
177
148
|
# require 'pagy/extras/overflow'
|
178
149
|
# Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception)
|
179
150
|
|
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'
|
183
|
-
|
184
151
|
# Trim extra: Remove the page=1 param from links
|
185
152
|
# See https://ddnexus.github.io/pagy/docs/extras/trim
|
186
153
|
# require 'pagy/extras/trim'
|
@@ -192,9 +159,15 @@ require "pagy/extras/bootstrap"
|
|
192
159
|
# require 'pagy/extras/standalone'
|
193
160
|
# Pagy::DEFAULT[:url] = 'http://www.example.com/subdir' # optional default
|
194
161
|
|
162
|
+
# Jsonapi extra: Implements JSON:API specifications
|
163
|
+
# See https://ddnexus.github.io/pagy/docs/extras/jsonapi
|
164
|
+
# require 'pagy/extras/jsonapi' # must be required after the other extras
|
165
|
+
# set to false only if you want to make :jsonapi an opt-in variable
|
166
|
+
# Pagy::DEFAULT[:jsonapi] = false # default true
|
167
|
+
|
195
168
|
# Rails
|
196
169
|
# Enable the .js file required by the helpers that use javascript
|
197
|
-
# (pagy*_nav_js, pagy*_combo_nav_js, and
|
170
|
+
# (pagy*_nav_js, pagy*_combo_nav_js, and pagy_limit_selector_js)
|
198
171
|
# See https://ddnexus.github.io/pagy/docs/api/javascript
|
199
172
|
|
200
173
|
# With the asset pipeline
|
@@ -235,8 +208,5 @@ require "pagy/extras/bootstrap"
|
|
235
208
|
# See https://ddnexus.github.io/pagy/docs/extras/i18n
|
236
209
|
# require 'pagy/extras/i18n'
|
237
210
|
|
238
|
-
# Default i18n key
|
239
|
-
# Pagy::DEFAULT[:i18n_key] = 'pagy.item_name' # default
|
240
|
-
|
241
211
|
# When you are done setting your own default freeze it, so it will not get changed accidentally
|
242
212
|
Pagy::DEFAULT.freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geoblacklight_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Larson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_storage_validations
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '7.
|
47
|
+
version: '7.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '7.
|
54
|
+
version: '7.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: blacklight_advanced_search
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,14 +184,14 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: '4.
|
187
|
+
version: '4.0'
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: '4.
|
194
|
+
version: '4.0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: haml
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -296,14 +296,14 @@ dependencies:
|
|
296
296
|
requirements:
|
297
297
|
- - "~>"
|
298
298
|
- !ruby/object:Gem::Version
|
299
|
-
version: '
|
299
|
+
version: '9.0'
|
300
300
|
type: :runtime
|
301
301
|
prerelease: false
|
302
302
|
version_requirements: !ruby/object:Gem::Requirement
|
303
303
|
requirements:
|
304
304
|
- - "~>"
|
305
305
|
- !ruby/object:Gem::Version
|
306
|
-
version: '
|
306
|
+
version: '9.0'
|
307
307
|
- !ruby/object:Gem::Dependency
|
308
308
|
name: paper_trail
|
309
309
|
requirement: !ruby/object:Gem::Requirement
|
@@ -353,9 +353,6 @@ dependencies:
|
|
353
353
|
- - "~>"
|
354
354
|
- !ruby/object:Gem::Version
|
355
355
|
version: '7.0'
|
356
|
-
- - "<"
|
357
|
-
- !ruby/object:Gem::Version
|
358
|
-
version: '7.3'
|
359
356
|
type: :runtime
|
360
357
|
prerelease: false
|
361
358
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -363,9 +360,6 @@ dependencies:
|
|
363
360
|
- - "~>"
|
364
361
|
- !ruby/object:Gem::Version
|
365
362
|
version: '7.0'
|
366
|
-
- - "<"
|
367
|
-
- !ruby/object:Gem::Version
|
368
|
-
version: '7.3'
|
369
363
|
- !ruby/object:Gem::Dependency
|
370
364
|
name: ruby-progressbar
|
371
365
|
requirement: !ruby/object:Gem::Requirement
|
@@ -813,6 +807,7 @@ files:
|
|
813
807
|
- app/assets/stylesheets/geoblacklight_admin/modules/_icons.scss
|
814
808
|
- app/assets/stylesheets/geoblacklight_admin/modules/_images.scss
|
815
809
|
- app/assets/stylesheets/geoblacklight_admin/modules/_nav.scss
|
810
|
+
- app/assets/stylesheets/geoblacklight_admin/modules/_pagy.scss
|
816
811
|
- app/assets/stylesheets/geoblacklight_admin/modules/_results.scss
|
817
812
|
- app/assets/stylesheets/geoblacklight_admin/modules/_tables.scss
|
818
813
|
- app/assets/stylesheets/geoblacklight_admin/modules/_toasts.scss
|
@@ -842,9 +837,11 @@ files:
|
|
842
837
|
- app/controllers/admin/reference_types_controller.rb
|
843
838
|
- app/controllers/admin/search_controller.rb
|
844
839
|
- app/controllers/admin/users_controller.rb
|
840
|
+
- app/controllers/concerns/blacklight/catalog.rb
|
845
841
|
- app/helpers/asset_helper.rb
|
846
842
|
- app/helpers/bulk_actions_helper.rb
|
847
843
|
- app/helpers/document_helper.rb
|
844
|
+
- app/helpers/facets_helper.rb
|
848
845
|
- app/helpers/form_input_helper.rb
|
849
846
|
- app/helpers/geoblacklight_admin_helper.rb
|
850
847
|
- app/helpers/mappings_helper.rb
|
@@ -1143,7 +1140,10 @@ files:
|
|
1143
1140
|
- app/views/admin/shared/_schema_timestamp.html.erb
|
1144
1141
|
- app/views/admin/shared/_toast.html.erb
|
1145
1142
|
- app/views/admin/users/index.html.erb
|
1143
|
+
- app/views/catalog/_facet_pagination.html.erb
|
1146
1144
|
- app/views/catalog/_gbl_admin_data_dictionaries.html.erb
|
1145
|
+
- app/views/catalog/_paginate_compact.html.erb
|
1146
|
+
- app/views/catalog/_results_pagination.html.erb
|
1147
1147
|
- app/views/catalog/_show_gbl_admin.html.erb
|
1148
1148
|
- app/views/catalog/_show_gbl_admin_data_dictionaries.html.erb
|
1149
1149
|
- app/views/catalog/data_dictionaries.html.erb
|