blacklight 7.41.0 → 8.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.env +2 -3
- data/.github/workflows/ruby.yml +81 -0
- data/.rubocop.yml +243 -14
- data/.rubocop_todo.yml +137 -429
- data/Gemfile +11 -6
- data/README.md +11 -3
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.esm.js +384 -0
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -0
- data/app/assets/javascripts/blacklight/blacklight.js +374 -493
- data/app/assets/javascripts/blacklight/blacklight.js.map +1 -0
- data/app/assets/stylesheets/blacklight/_autocomplete.scss +25 -0
- data/app/assets/stylesheets/blacklight/_blacklight_base.scss +1 -1
- data/app/assets/stylesheets/blacklight/_bookmark.scss +16 -0
- data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +8 -0
- data/app/assets/stylesheets/blacklight/_constraints.scss +4 -4
- data/app/assets/stylesheets/blacklight/_facets.scss +72 -44
- data/app/assets/stylesheets/blacklight/_header.scss +0 -15
- data/app/assets/stylesheets/blacklight/_icons.scss +0 -14
- data/app/assets/stylesheets/blacklight/_mixins.scss +20 -0
- data/app/assets/stylesheets/blacklight/_modal.scss +8 -2
- data/app/assets/stylesheets/blacklight/_search_form.scss +30 -3
- data/app/assets/stylesheets/blacklight/_search_history.scss +10 -1
- data/app/assets/stylesheets/blacklight/_search_results.scss +6 -2
- data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +4 -1
- data/app/builders/blacklight/action_builder.rb +18 -9
- data/app/components/blacklight/advanced_search_form_component.html.erb +3 -3
- data/app/components/blacklight/advanced_search_form_component.rb +8 -10
- data/app/components/blacklight/constraints_component.rb +27 -37
- data/app/components/blacklight/document/action_component.rb +12 -10
- data/app/components/blacklight/document/actions_component.rb +2 -2
- data/app/components/blacklight/document/bookmark_component.html.erb +9 -0
- data/app/components/blacklight/document/bookmark_component.rb +4 -2
- data/app/components/blacklight/document/citation_component.rb +5 -3
- data/app/components/blacklight/document/group_component.rb +7 -3
- data/app/components/blacklight/document/sidebar_component.html.erb +2 -0
- data/app/components/blacklight/document/sidebar_component.rb +16 -0
- data/app/components/blacklight/document/thumbnail_component.html.erb +2 -7
- data/app/components/blacklight/document/thumbnail_component.rb +1 -9
- data/app/components/blacklight/document_component.html.erb +1 -1
- data/app/components/blacklight/document_component.rb +16 -78
- data/app/components/blacklight/document_metadata_component.html.erb +2 -4
- data/app/components/blacklight/document_metadata_component.rb +5 -10
- data/app/components/blacklight/facet_component.rb +3 -3
- data/app/components/blacklight/facet_field_checkboxes_component.html.erb +4 -4
- data/app/components/blacklight/facet_field_checkboxes_component.rb +1 -1
- data/app/components/blacklight/facet_field_component.html.erb +4 -5
- data/app/components/blacklight/facet_field_component.rb +9 -2
- data/app/components/blacklight/facet_field_list_component.html.erb +3 -3
- data/app/components/blacklight/facet_field_list_component.rb +37 -5
- data/app/components/blacklight/facet_field_no_layout_component.rb +0 -2
- data/app/components/blacklight/facet_item_component.rb +1 -43
- data/app/components/blacklight/facet_item_pivot_component.rb +21 -23
- data/app/components/blacklight/header_component.rb +1 -1
- data/app/components/blacklight/hidden_search_state_component.rb +1 -2
- data/app/components/blacklight/icons/icon_component.rb +4 -9
- data/app/components/blacklight/icons/legacy_icon_component.rb +30 -0
- data/app/components/blacklight/icons/list_component.rb +16 -0
- data/app/components/blacklight/icons/search_component.rb +16 -0
- data/app/components/blacklight/metadata_field_component.html.erb +2 -2
- data/app/components/blacklight/metadata_field_component.rb +24 -8
- data/app/components/blacklight/metadata_field_layout_component.rb +4 -25
- data/app/components/blacklight/response/facet_group_component.html.erb +3 -5
- data/app/components/blacklight/response/facet_group_component.rb +29 -8
- data/app/components/blacklight/response/pagination_component.html.erb +1 -1
- data/app/components/blacklight/response/pagination_component.rb +2 -11
- data/app/components/blacklight/response/sort_component.html.erb +6 -1
- data/app/components/blacklight/response/sort_component.rb +1 -16
- data/app/components/blacklight/response/spellcheck_component.rb +18 -7
- data/app/components/blacklight/response/view_type_button_component.rb +3 -7
- data/app/components/blacklight/response/view_type_component.rb +4 -6
- data/app/components/blacklight/search/sidebar_component.html.erb +8 -0
- data/app/components/blacklight/search/sidebar_component.rb +17 -0
- data/app/components/blacklight/search_bar_component.html.erb +20 -15
- data/app/components/blacklight/search_bar_component.rb +2 -16
- data/app/components/blacklight/search_button_component.rb +3 -3
- data/app/components/blacklight/search_context_component.rb +43 -10
- data/app/components/blacklight/search_header_component.html.erb +2 -0
- data/app/components/blacklight/search_header_component.rb +6 -0
- data/app/components/blacklight/start_over_button_component.rb +5 -3
- data/app/components/blacklight/system/dropdown_component.rb +8 -5
- data/app/components/blacklight/system/flash_message_component.html.erb +4 -2
- data/app/components/blacklight/system/flash_message_component.rb +12 -3
- data/app/components/blacklight/system/modal_component.html.erb +1 -1
- data/app/components/blacklight/system/modal_component.rb +1 -3
- data/app/components/blacklight/top_navbar_component.html.erb +1 -1
- data/app/components/blacklight/top_navbar_component.rb +0 -4
- data/app/controllers/bookmarks_controller.rb +1 -0
- data/app/controllers/catalog_controller.rb +1 -0
- data/app/controllers/concerns/blacklight/bookmarks.rb +10 -9
- data/app/controllers/concerns/blacklight/catalog.rb +21 -83
- data/app/controllers/concerns/blacklight/controller.rb +3 -41
- data/app/controllers/concerns/blacklight/search_context.rb +25 -7
- data/app/controllers/concerns/blacklight/search_history.rb +2 -0
- data/app/controllers/concerns/blacklight/searchable.rb +12 -1
- data/app/controllers/concerns/blacklight/token_based_user.rb +13 -1
- data/app/controllers/search_history_controller.rb +1 -0
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +12 -310
- data/app/helpers/blacklight/catalog_helper_behavior.rb +22 -139
- data/app/helpers/blacklight/component_helper_behavior.rb +2 -53
- data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -119
- data/app/helpers/blacklight/facets_helper_behavior.rb +4 -321
- data/app/helpers/blacklight/icon_helper_behavior.rb +5 -7
- data/app/helpers/blacklight/layout_helper_behavior.rb +4 -3
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +11 -31
- data/app/helpers/blacklight/url_helper_behavior.rb +12 -97
- data/app/helpers/blacklight_helper.rb +1 -0
- data/app/helpers/catalog_helper.rb +1 -0
- data/app/javascript/blacklight/bookmark_toggle.js +13 -19
- data/app/javascript/blacklight/button_focus.js +12 -10
- data/app/javascript/blacklight/checkbox_submit.js +68 -123
- data/app/javascript/blacklight/core.js +5 -7
- data/app/javascript/blacklight/index.js +13 -0
- data/app/javascript/blacklight/modal.js +99 -164
- data/app/javascript/blacklight/modalForm.js +60 -0
- data/app/javascript/blacklight/search_context.js +46 -54
- data/app/models/blacklight/facet_paginator.rb +3 -2
- data/app/models/blacklight/icon.rb +4 -2
- data/app/models/bookmark.rb +0 -2
- data/app/models/concerns/blacklight/configurable.rb +5 -4
- data/app/models/concerns/blacklight/document/active_model_shim.rb +1 -10
- data/app/models/concerns/blacklight/document/cache_key.rb +1 -0
- data/app/models/concerns/blacklight/document/dublin_core.rb +2 -1
- data/app/models/concerns/blacklight/document/email.rb +1 -0
- data/app/models/concerns/blacklight/document/export.rb +2 -1
- data/app/models/concerns/blacklight/document/extensions.rb +1 -0
- data/app/models/concerns/blacklight/document/schema_org.rb +1 -0
- data/app/models/concerns/blacklight/document/semantic_fields.rb +2 -1
- data/app/models/concerns/blacklight/document/sms.rb +1 -0
- data/app/models/concerns/blacklight/suggest/response.rb +1 -0
- data/app/models/concerns/blacklight/user.rb +17 -8
- data/app/models/record_mailer.rb +13 -12
- data/app/models/search.rb +1 -7
- data/app/models/solr_document.rb +1 -0
- data/app/presenters/blacklight/clause_presenter.rb +1 -1
- data/app/presenters/blacklight/document_presenter.rb +23 -50
- data/app/presenters/blacklight/facet_field_presenter.rb +39 -14
- data/app/presenters/blacklight/facet_grouped_item_presenter.rb +1 -5
- data/app/presenters/blacklight/facet_item_pivot_presenter.rb +60 -0
- data/app/presenters/blacklight/facet_item_presenter.rb +3 -9
- data/app/presenters/blacklight/field_presenter.rb +1 -0
- data/app/presenters/blacklight/index_presenter.rb +2 -40
- data/app/presenters/blacklight/json_presenter.rb +10 -6
- data/app/presenters/blacklight/rendering/link_to_facet.rb +2 -5
- data/app/presenters/blacklight/show_presenter.rb +1 -9
- data/app/presenters/blacklight/thumbnail_presenter.rb +1 -1
- data/app/services/blacklight/bookmarks_search_builder.rb +22 -0
- data/app/services/blacklight/field_retriever.rb +12 -21
- data/app/services/blacklight/search_service.rb +10 -17
- data/app/values/blacklight/types.rb +0 -18
- data/app/views/bookmarks/_clear_bookmarks_widget.html.erb +8 -1
- data/app/views/bookmarks/_tools.html.erb +7 -12
- data/app/views/catalog/_advanced_search_form.html.erb +0 -1
- data/app/views/catalog/_bookmark_control.html.erb +1 -1
- data/app/views/catalog/_citation.html.erb +1 -1
- data/app/views/catalog/_constraints.html.erb +1 -14
- data/app/views/catalog/_document.atom.builder +12 -14
- data/app/views/catalog/_document.html.erb +5 -3
- data/app/views/catalog/_document.rss.builder +2 -4
- data/app/views/catalog/_facet_layout.html.erb +2 -2
- data/app/views/catalog/_facets.html.erb +5 -4
- data/app/views/catalog/_home_text.html.erb +2 -14
- data/app/views/catalog/_per_page_widget.html.erb +10 -1
- data/app/views/catalog/_search_form.html.erb +2 -2
- data/app/views/catalog/_search_header.html.erb +1 -2
- data/app/views/catalog/_search_results.html.erb +2 -2
- data/app/views/catalog/_search_sidebar.html.erb +5 -1
- data/app/views/catalog/_show_main_content.html.erb +11 -16
- data/app/views/catalog/_show_sidebar.html.erb +2 -2
- data/app/views/catalog/_show_tools.html.erb +8 -14
- data/app/views/catalog/_view_type_group.html.erb +1 -1
- data/app/views/catalog/email.html.erb +2 -2
- data/app/views/catalog/email_success.html.erb +5 -6
- data/app/views/catalog/facet.html.erb +7 -5
- data/app/views/catalog/index.atom.builder +12 -14
- data/app/views/catalog/index.html.erb +4 -1
- data/app/views/catalog/index.json.jbuilder +19 -19
- data/app/views/catalog/index.rss.builder +1 -1
- data/app/views/catalog/opensearch.xml.builder +1 -1
- data/app/views/catalog/sms.html.erb +2 -2
- data/app/views/catalog/sms_success.html.erb +5 -6
- data/app/views/catalog/suggest.html.erb +3 -0
- data/app/views/kaminari/blacklight/_page.html.erb +2 -1
- data/app/views/layouts/blacklight/base.html.erb +13 -2
- data/app/views/search_history/index.html.erb +6 -2
- data/app/views/shared/_flash_messages.html.erb +1 -1
- data/app/views/shared/_modal.html.erb +3 -3
- data/blacklight.gemspec +7 -11
- data/config/importmap.rb +3 -0
- data/config/locales/blacklight.ar.yml +0 -1
- data/config/locales/blacklight.ca.yml +0 -1
- data/config/locales/blacklight.de.yml +0 -1
- data/config/locales/blacklight.en.yml +0 -2
- data/config/locales/blacklight.es.yml +0 -1
- data/config/locales/blacklight.fr.yml +0 -1
- data/config/locales/blacklight.hu.yml +0 -1
- data/config/locales/blacklight.it.yml +0 -1
- data/config/locales/blacklight.nl.yml +0 -1
- data/config/locales/blacklight.pt-BR.yml +0 -1
- data/config/locales/blacklight.sq.yml +0 -1
- data/config/locales/blacklight.zh.yml +0 -1
- data/config/routes.rb +3 -2
- data/db/migrate/20140202020201_create_searches.rb +1 -0
- data/db/migrate/20140202020202_create_bookmarks.rb +1 -0
- data/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb +1 -0
- data/docker-compose.yml +3 -3
- data/lib/blacklight/abstract_repository.rb +1 -6
- data/lib/blacklight/component.rb +47 -10
- data/lib/blacklight/configuration/context.rb +4 -4
- data/lib/blacklight/configuration/display_field.rb +7 -9
- data/lib/blacklight/configuration/facet_field.rb +17 -11
- data/lib/blacklight/configuration/field.rb +1 -0
- data/lib/blacklight/configuration/fields.rb +12 -15
- data/lib/blacklight/configuration/index_field.rb +1 -0
- data/lib/blacklight/configuration/null_display_field.rb +17 -0
- data/lib/blacklight/configuration/search_field.rb +1 -0
- data/lib/blacklight/configuration/show_field.rb +1 -0
- data/lib/blacklight/configuration/sort_field.rb +1 -0
- data/lib/blacklight/configuration/tool_config.rb +1 -0
- data/lib/blacklight/configuration/view_config.rb +14 -10
- data/lib/blacklight/configuration.rb +310 -365
- data/lib/blacklight/engine.rb +8 -24
- data/lib/blacklight/exceptions.rb +2 -2
- data/lib/blacklight/nested_open_struct_with_hash_access.rb +7 -13
- data/lib/blacklight/open_struct_with_hash_access.rb +23 -6
- data/lib/blacklight/parameters.rb +7 -21
- data/lib/blacklight/routes/exportable.rb +1 -0
- data/lib/blacklight/routes/searchable.rb +2 -1
- data/lib/blacklight/routes.rb +1 -0
- data/lib/blacklight/search_builder.rb +10 -10
- data/lib/blacklight/search_state/filter_field.rb +8 -25
- data/lib/blacklight/search_state/pivot_filter_field.rb +144 -0
- data/lib/blacklight/search_state.rb +23 -79
- data/lib/blacklight/solr/document.rb +1 -0
- data/lib/blacklight/solr/facet_paginator.rb +1 -0
- data/lib/blacklight/solr/repository.rb +4 -24
- data/lib/blacklight/solr/request.rb +1 -0
- data/lib/blacklight/solr/response/facets.rb +21 -5
- data/lib/blacklight/solr/response/group.rb +1 -0
- data/lib/blacklight/solr/response/group_response.rb +1 -0
- data/lib/blacklight/solr/response/more_like_this.rb +1 -0
- data/lib/blacklight/solr/response/pagination_methods.rb +4 -3
- data/lib/blacklight/solr/response/params.rb +5 -4
- data/lib/blacklight/solr/response/response.rb +1 -0
- data/lib/blacklight/solr/response/spelling.rb +1 -0
- data/lib/blacklight/solr/response.rb +16 -3
- data/lib/blacklight/solr/search_builder_behavior.rb +16 -35
- data/lib/blacklight/solr.rb +7 -0
- data/lib/blacklight/version.rb +1 -0
- data/lib/blacklight.rb +26 -14
- data/lib/generators/blacklight/assets/importmap_generator.rb +55 -0
- data/lib/generators/blacklight/assets/propshaft_generator.rb +25 -0
- data/lib/generators/blacklight/assets/sprockets_generator.rb +66 -0
- data/lib/generators/blacklight/assets_generator.rb +13 -86
- data/lib/generators/blacklight/controller_generator.rb +4 -3
- data/lib/generators/blacklight/document_generator.rb +1 -0
- data/lib/generators/blacklight/install_generator.rb +4 -3
- data/lib/generators/blacklight/models_generator.rb +1 -0
- data/lib/generators/blacklight/search_builder_generator.rb +1 -0
- data/lib/generators/blacklight/solr_generator.rb +1 -1
- data/lib/generators/blacklight/templates/catalog_controller.rb +34 -8
- data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +1 -70
- data/lib/generators/blacklight/test_support_generator.rb +5 -3
- data/lib/generators/blacklight/user_generator.rb +7 -9
- data/lib/railties/blacklight.rake +6 -7
- data/package.json +10 -13
- data/rollup.config.js +27 -0
- data/spec/components/blacklight/constraints_component_spec.rb +17 -13
- data/spec/components/blacklight/document/action_component_spec.rb +6 -1
- data/spec/components/blacklight/document_component_spec.rb +22 -131
- data/spec/components/blacklight/facet_component_spec.rb +3 -18
- data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +1 -2
- data/spec/components/blacklight/facet_field_list_component_spec.rb +7 -6
- data/spec/components/blacklight/facet_item_pivot_component_spec.rb +10 -9
- data/spec/components/blacklight/response/view_type_component_spec.rb +66 -0
- data/spec/components/blacklight/search_bar_component_spec.rb +1 -1
- data/spec/components/blacklight/search_context_component_spec.rb +17 -8
- data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +1 -6
- data/spec/controllers/blacklight/{base_spec.rb → catalog_spec.rb} +2 -2
- data/spec/controllers/bookmarks_controller_spec.rb +2 -3
- data/spec/controllers/catalog_controller_spec.rb +13 -135
- data/spec/features/advanced_search_spec.rb +0 -56
- data/spec/features/autocomplete_spec.rb +1 -1
- data/spec/features/axe_spec.rb +1 -6
- data/spec/features/bookmarks_spec.rb +1 -1
- data/spec/features/facets_spec.rb +6 -4
- data/spec/features/search_context_spec.rb +5 -11
- data/spec/features/search_results_spec.rb +0 -33
- data/spec/features/sitelinks_search_box.rb +13 -0
- data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +2 -138
- data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +0 -387
- data/spec/helpers/blacklight/icon_helper_behavior_spec.rb +8 -0
- data/spec/helpers/blacklight/layout_helper_behavior_spec.rb +3 -20
- data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +5 -7
- data/spec/helpers/blacklight/url_helper_behavior_spec.rb +9 -131
- data/spec/helpers/blacklight_helper_spec.rb +8 -252
- data/spec/helpers/catalog_helper_spec.rb +7 -118
- data/spec/i18n_spec.rb +1 -0
- data/spec/integration/generators/blacklight/solr_generator_spec.rb +1 -1
- data/spec/lib/blacklight/component_spec.rb +27 -32
- data/spec/lib/blacklight/configuration/facet_field_spec.rb +27 -16
- data/spec/lib/blacklight/configuration/field_spec.rb +1 -1
- data/spec/lib/blacklight/configuration/view_config_spec.rb +1 -1
- data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +2 -2
- data/spec/lib/blacklight/parameters_spec.rb +1 -4
- data/spec/lib/blacklight/search_state/filter_field_spec.rb +4 -4
- data/spec/lib/blacklight/search_state/pivot_filter_field_spec.rb +117 -0
- data/spec/lib/blacklight/search_state_spec.rb +80 -198
- data/spec/lib/tasks/blacklight_task_spec.rb +1 -0
- data/spec/models/blacklight/configuration_spec.rb +17 -51
- data/spec/models/blacklight/document/active_model_shim_spec.rb +2 -2
- data/spec/models/blacklight/icon_spec.rb +31 -15
- data/spec/models/blacklight/search_builder_spec.rb +9 -9
- data/spec/models/blacklight/solr/document_spec.rb +3 -3
- data/spec/models/blacklight/solr/repository_spec.rb +0 -45
- data/spec/models/blacklight/solr/response/facets_spec.rb +27 -27
- data/spec/models/blacklight/solr/response/group_response_spec.rb +1 -0
- data/spec/models/blacklight/solr/response/group_spec.rb +1 -0
- data/spec/models/blacklight/solr/response_spec.rb +9 -2
- data/spec/models/blacklight/solr/search_builder_spec.rb +24 -44
- data/spec/models/blacklight/user_spec.rb +22 -0
- data/spec/models/solr_document_spec.rb +3 -9
- data/spec/presenters/blacklight/clause_presenter_spec.rb +1 -0
- data/spec/presenters/blacklight/document_presenter_spec.rb +2 -3
- data/spec/presenters/blacklight/facet_field_presenter_spec.rb +85 -12
- data/spec/presenters/blacklight/facet_grouped_item_presenter_spec.rb +1 -0
- data/spec/presenters/blacklight/facet_item_presenter_spec.rb +14 -13
- data/spec/presenters/blacklight/field_presenter_spec.rb +0 -14
- data/spec/presenters/blacklight/index_presenter_spec.rb +2 -5
- data/spec/presenters/blacklight/json_presenter_spec.rb +1 -0
- data/spec/presenters/blacklight/link_alternate_presenter_spec.rb +3 -2
- data/spec/presenters/blacklight/show_presenter_spec.rb +20 -30
- data/spec/presenters/thumbnail_presenter_spec.rb +1 -1
- data/spec/requests/load_suggestions_spec.rb +16 -0
- data/spec/routing/catalog_routing_spec.rb +2 -1
- data/spec/services/blacklight/search_service_spec.rb +39 -76
- data/spec/spec_helper.rb +8 -9
- data/spec/support/controller_level_helpers.rb +1 -2
- data/spec/support/features/search_helpers.rb +39 -0
- data/spec/support/features/session_helpers.rb +1 -0
- data/spec/support/features.rb +3 -0
- data/spec/support/view_component_capybara_test_helpers.rb +8 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +9 -2
- data/spec/views/catalog/_document.html.erb_spec.rb +3 -34
- data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +0 -2
- data/spec/views/catalog/_search_header.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +5 -66
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +17 -9
- data/spec/views/catalog/email_success.html.erb_spec.rb +2 -2
- data/spec/views/catalog/facet.html.erb_spec.rb +6 -3
- data/spec/views/catalog/index.atom.builder_spec.rb +17 -11
- data/spec/views/catalog/index.html.erb_spec.rb +5 -6
- data/spec/views/catalog/index.json.jbuilder_spec.rb +2 -2
- data/spec/views/catalog/show.html.erb_spec.rb +3 -25
- data/spec/views/catalog/sms_success.html.erb_spec.rb +2 -2
- data/tasks/blacklight.rake +11 -9
- data/template.demo.rb +7 -7
- metadata +77 -189
- data/.babelrc +0 -11
- data/.github/matrix.json +0 -62
- data/.github/workflows/build.yml +0 -16
- data/.github/workflows/lint.yml +0 -23
- data/.github/workflows/main.yml +0 -23
- data/.github/workflows/test.yml +0 -53
- data/app/assets/images/blacklight/list.svg +0 -1
- data/app/assets/images/blacklight/search.svg +0 -1
- data/app/assets/stylesheets/blacklight/_twitter_typeahead.scss +0 -37
- data/app/components/blacklight/content_areas_shim.rb +0 -13
- data/app/components/blacklight/search/per_page_component.html.erb +0 -2
- data/app/components/blacklight/search/per_page_component.rb +0 -50
- data/app/components/blacklight/search_context/server_item_pagination_component.html.erb +0 -10
- data/app/components/blacklight/search_context/server_item_pagination_component.rb +0 -15
- data/app/components/blacklight/system/dropdown_button_component.rb +0 -18
- data/app/controllers/concerns/blacklight/base.rb +0 -12
- data/app/controllers/concerns/blacklight/default_component_configuration.rb +0 -64
- data/app/controllers/concerns/blacklight/facet.rb +0 -69
- data/app/controllers/concerns/blacklight/search_fields.rb +0 -46
- data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +0 -27
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +0 -188
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +0 -97
- data/app/helpers/blacklight/suggest_helper_behavior.rb +0 -13
- data/app/javascript/blacklight/autocomplete.js +0 -36
- data/app/javascript/blacklight/facet_load.js +0 -22
- data/app/presenters/blacklight/search_bar_presenter.rb +0 -47
- data/app/views/catalog/_constraints_element.html.erb +0 -14
- data/app/views/catalog/_document_action.html.erb +0 -5
- data/app/views/catalog/_facet_group.html.erb +0 -5
- data/app/views/catalog/_facet_limit.html.erb +0 -3
- data/app/views/catalog/_index.html.erb +0 -1
- data/app/views/catalog/_index_header.html.erb +0 -22
- data/app/views/catalog/_previous_next_doc.html.erb +0 -2
- data/app/views/catalog/_show.html.erb +0 -6
- data/app/views/catalog/_show_header.html.erb +0 -2
- data/app/views/catalog/_thumbnail.html.erb +0 -1
- data/lib/blacklight/deprecations/engine_configuration.rb +0 -66
- data/lib/blacklight/deprecations/search_state_normalization.rb +0 -52
- data/spec/components/blacklight/header_component_spec.rb +0 -20
- data/spec/components/blacklight/icons/icon_component_spec.rb +0 -42
- data/spec/components/blacklight/response/pagination_component_spec.rb +0 -53
- data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +0 -35
- data/spec/controllers/blacklight/facet_spec.rb +0 -33
- data/spec/controllers/blacklight/search_fields_spec.rb +0 -62
- data/spec/features/citation_spec.rb +0 -10
- data/spec/features/sitelinks_search_box_spec.rb +0 -13
- data/spec/features/sms_spec.rb +0 -12
- data/spec/helpers/blacklight/hash_as_hidden_fields_behavior_spec.rb +0 -26
- data/spec/helpers/blacklight/render_constraints_helper_behavior_spec.rb +0 -92
- data/spec/helpers/blacklight/search_history_constraints_helper_behavior_spec.rb +0 -101
- data/spec/helpers/blacklight/suggest_helper_behavior_spec.rb +0 -48
- data/spec/lib/blacklight/engine_spec.rb +0 -41
- data/spec/presenters/blacklight/search_bar_presenter_spec.rb +0 -94
- data/spec/services/blacklight/field_retriever_spec.rb +0 -17
- data/spec/support/view_component_test_helpers.rb +0 -35
- data/spec/views/catalog/_constraints.html.erb_spec.rb +0 -33
- data/spec/views/catalog/_facet_group.html.erb_spec.rb +0 -84
- data/spec/views/catalog/_facets.html.erb_spec.rb +0 -15
- data/spec/views/catalog/_index.html.erb_spec.rb +0 -62
- data/spec/views/catalog/_index_header.html.erb_spec.rb +0 -35
- data/spec/views/catalog/_previous_next_doc.html.erb_spec.rb +0 -22
- data/spec/views/catalog/_show.html.erb_spec.rb +0 -62
- data/spec/views/catalog/_thumbnail.html.erb_spec.rb +0 -38
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
module Blacklight
|
4
4
|
class ConstraintsComponent < Blacklight::Component
|
5
|
-
include Blacklight::ContentAreasShim
|
6
|
-
|
7
5
|
renders_many :query_constraints_area
|
8
6
|
renders_many :facet_constraints_area
|
9
7
|
renders_many :additional_constraints
|
@@ -42,60 +40,52 @@ module Blacklight
|
|
42
40
|
# rubocop:enable Metrics/ParameterLists
|
43
41
|
|
44
42
|
def query_constraints
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
@
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
**@query_constraint_component_options
|
55
|
-
)
|
43
|
+
if @search_state.query_param.present?
|
44
|
+
helpers.render(
|
45
|
+
@query_constraint_component.new(
|
46
|
+
search_state: @search_state,
|
47
|
+
value: @search_state.query_param,
|
48
|
+
label: label,
|
49
|
+
remove_path: remove_path,
|
50
|
+
classes: 'query',
|
51
|
+
**@query_constraint_component_options
|
56
52
|
)
|
57
|
-
|
58
|
-
|
59
|
-
|
53
|
+
)
|
54
|
+
else
|
55
|
+
''.html_safe
|
60
56
|
end + helpers.render(@facet_constraint_component.with_collection(clause_presenters.to_a, **@facet_constraint_component_options))
|
61
57
|
end
|
62
58
|
|
59
|
+
def remove_path
|
60
|
+
helpers.search_action_path(@search_state.remove_query_params)
|
61
|
+
end
|
62
|
+
|
63
63
|
def facet_constraints
|
64
64
|
helpers.render(@facet_constraint_component.with_collection(facet_item_presenters.to_a, **@facet_constraint_component_options))
|
65
65
|
end
|
66
66
|
|
67
67
|
def render?
|
68
|
-
|
68
|
+
@search_state.has_constraints?
|
69
69
|
end
|
70
70
|
|
71
71
|
private
|
72
72
|
|
73
|
-
# @deprecated
|
74
|
-
def start_over_path
|
75
|
-
Deprecation.silence(Blacklight::UrlHelperBehavior) do
|
76
|
-
helpers.start_over_path
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
73
|
def label
|
81
|
-
|
82
|
-
|
83
|
-
end
|
74
|
+
search_field = @search_state.params[:search_field]
|
75
|
+
helpers.label_for_search_field(search_field) unless helpers.default_search_field?(search_field)
|
84
76
|
end
|
85
77
|
|
86
78
|
def facet_item_presenters
|
87
79
|
return to_enum(:facet_item_presenters) unless block_given?
|
88
80
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
next if val.blank?
|
81
|
+
@search_state.filters.map do |facet|
|
82
|
+
facet.each_value do |val|
|
83
|
+
next if val.blank?
|
93
84
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
85
|
+
if val.is_a?(Array)
|
86
|
+
yield inclusive_facet_item_presenter(facet.config, val, facet.key) if val.any?(&:present?)
|
87
|
+
else
|
88
|
+
yield facet_item_presenter(facet.config, val, facet.key)
|
99
89
|
end
|
100
90
|
end
|
101
91
|
end
|
@@ -111,7 +101,7 @@ module Blacklight
|
|
111
101
|
end
|
112
102
|
|
113
103
|
def facet_item_presenter(facet_config, facet_item, facet_field)
|
114
|
-
|
104
|
+
facet_config.item_presenter.new(facet_item, facet_config, helpers, facet_field)
|
115
105
|
end
|
116
106
|
|
117
107
|
def inclusive_facet_item_presenter(facet_config, facet_item, facet_field)
|
@@ -23,10 +23,7 @@ module Blacklight
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def using_default_document_action?
|
26
|
-
|
27
|
-
return false unless @action.partial == 'document_action'
|
28
|
-
|
29
|
-
helpers.partial_from_blacklight?(@action.partial)
|
26
|
+
@action.component || @action.partial == 'document_action'
|
30
27
|
end
|
31
28
|
|
32
29
|
def link_to_modal_control
|
@@ -42,9 +39,7 @@ module Blacklight
|
|
42
39
|
end
|
43
40
|
|
44
41
|
def label
|
45
|
-
|
46
|
-
helpers.document_action_label(@action.name, @action)
|
47
|
-
end
|
42
|
+
t("blacklight.tools.#{@action.name}", default: @action.label || @action.name.to_s.humanize)
|
48
43
|
end
|
49
44
|
|
50
45
|
# Action buttons get their URLs in one of three ways:
|
@@ -55,12 +50,19 @@ module Blacklight
|
|
55
50
|
# default Rails routing behavior)
|
56
51
|
# - calling out to an implicit helper method with a conventional name (unlikely)
|
57
52
|
def url
|
58
|
-
|
59
|
-
|
53
|
+
url_opts = @url_opts.merge(({ id: @document } if @document) || {})
|
54
|
+
if @action.path
|
55
|
+
helpers.public_send(@action.path, url_opts)
|
56
|
+
elsif url_opts[:id].class.respond_to?(:model_name)
|
57
|
+
helpers.url_for([@action.key.to_sym, url_opts[:id]])
|
58
|
+
else
|
59
|
+
helpers.public_send("#{@action.key}_#{helpers.controller_name}_path", url_opts)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
def key
|
64
|
+
@action.key
|
65
|
+
end
|
64
66
|
end
|
65
67
|
end
|
66
68
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Blacklight
|
4
4
|
module Document
|
5
|
-
# Render a
|
5
|
+
# Render a the set of actions for a document. One of the default actions is the bookmark control.
|
6
6
|
class ActionsComponent < Blacklight::Component
|
7
7
|
renders_many :actions, (lambda do |action:, component: nil, **kwargs|
|
8
8
|
component ||= action.component || Blacklight::Document::ActionComponent
|
@@ -28,7 +28,7 @@ module Blacklight
|
|
28
28
|
return if actions.present?
|
29
29
|
|
30
30
|
@actions.each do |a|
|
31
|
-
|
31
|
+
action(component: a.component, action: a)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -1,7 +1,9 @@
|
|
1
1
|
<%-
|
2
2
|
# the data-doc-id attribute is used by our JS that converts to a checkbox/label.
|
3
|
+
# we don't use the per-form csrf token
|
3
4
|
-%>
|
4
5
|
<%= form_tag(bookmark_path,
|
6
|
+
authenticity_token: false,
|
5
7
|
method: bookmarked? ? :delete : :put,
|
6
8
|
class: "bookmark-toggle",
|
7
9
|
data: {
|
@@ -10,6 +12,13 @@
|
|
10
12
|
absent: t('blacklight.search.bookmarks.absent'),
|
11
13
|
inprogress: t('blacklight.search.bookmarks.inprogress')
|
12
14
|
}) do %>
|
15
|
+
<div class="checkbox toggle-bookmark">
|
16
|
+
<label class="toggle-bookmark" data-checkboxsubmit-target="label">
|
17
|
+
<input type="checkbox" class="toggle-bookmark" data-checkboxsubmit-target="checkbox" <%= 'checked="checked"' if bookmarked? %>>
|
18
|
+
<span data-checkboxsubmit-target="span"><%= bookmarked? ? t('blacklight.search.bookmarks.present') : t('blacklight.search.bookmarks.absent') %></span>
|
19
|
+
</label>
|
20
|
+
</div>
|
21
|
+
|
13
22
|
<%= submit_tag(t(bookmarked? ? 'remove.button' : 'add.button', scope: 'blacklight.bookmarks'),
|
14
23
|
id: "bookmark_toggle_#{@document.id.to_s.parameterize}",
|
15
24
|
class: "bookmark-#{bookmarked? ? 'remove' : 'add'} btn btn-outline-secondary") %>
|
@@ -3,14 +3,16 @@
|
|
3
3
|
module Blacklight
|
4
4
|
module Document
|
5
5
|
# Render a bookmark widget to bookmark / unbookmark a document
|
6
|
-
class BookmarkComponent < Blacklight::
|
6
|
+
class BookmarkComponent < Blacklight::Document::ActionComponent
|
7
7
|
# @param [Blacklight::Document] document
|
8
|
+
# @param [Blacklight::Configuration::ToolConfig] action
|
8
9
|
# @param [Boolean] checked
|
9
10
|
# @param [Object] bookmark_path the rails route to use for bookmarks
|
10
|
-
def initialize(document:, checked: nil, bookmark_path: nil)
|
11
|
+
def initialize(document:, action: nil, checked: nil, bookmark_path: nil, **kwargs)
|
11
12
|
@document = document
|
12
13
|
@checked = checked
|
13
14
|
@bookmark_path = bookmark_path
|
15
|
+
super(document: document, action: action, **kwargs)
|
14
16
|
end
|
15
17
|
|
16
18
|
def bookmarked?
|
@@ -22,9 +22,11 @@ module Blacklight
|
|
22
22
|
|
23
23
|
# @return [String]
|
24
24
|
def title
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
presenter.heading
|
26
|
+
end
|
27
|
+
|
28
|
+
def presenter
|
29
|
+
helpers.document_presenter(@document)
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
@@ -17,10 +17,14 @@ module Blacklight
|
|
17
17
|
helpers.render_document_index @group.docs
|
18
18
|
end
|
19
19
|
|
20
|
+
# Get path to a search within a grouped result set
|
21
|
+
#
|
22
|
+
# @param [Blacklight::Solr::Response::Group] group
|
23
|
+
# @return [Hash]
|
20
24
|
def add_group_facet_params_and_redirect(group)
|
21
|
-
|
22
|
-
helpers.
|
23
|
-
|
25
|
+
helpers.search_action_path(
|
26
|
+
helpers.search_state.add_facet_params_and_redirect(group.field, group.key)
|
27
|
+
)
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
module Document
|
5
|
+
# Render the sidebar on the show view
|
6
|
+
class SidebarComponent < Blacklight::Component
|
7
|
+
# @param [Blacklight::DocumentPresenter] presenter
|
8
|
+
def initialize(presenter:)
|
9
|
+
@presenter = presenter
|
10
|
+
@document = presenter.document
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_reader :document
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,12 +1,7 @@
|
|
1
|
-
<% value =
|
1
|
+
<% value = presenter.thumbnail.render(@image_options) %>
|
2
2
|
|
3
3
|
<% if value %>
|
4
4
|
<div class="document-thumbnail">
|
5
|
-
|
6
|
-
<% warn_about_deprecated_behavior %>
|
7
|
-
<%= value %>
|
8
|
-
<% else %>
|
9
|
-
<%= helpers.link_to_document(presenter.document, value, 'aria-hidden': true, tabindex: -1, counter: @counter) %>
|
10
|
-
<% end %>
|
5
|
+
<%= helpers.link_to_document(presenter.document, value, 'aria-hidden': true, tabindex: -1, counter: @counter) %>
|
11
6
|
</div>
|
12
7
|
<% end %>
|
@@ -9,7 +9,7 @@ module Blacklight
|
|
9
9
|
# @param [Blacklight::DocumentPresenter] presenter
|
10
10
|
# @param [Integer] counter
|
11
11
|
# @param [Hash] image_options options for the thumbnail presenter's image tag
|
12
|
-
def initialize(presenter: nil, document: nil,
|
12
|
+
def initialize(counter:, presenter: nil, document: nil, image_options: {})
|
13
13
|
@presenter = presenter
|
14
14
|
@document = presenter&.document || document
|
15
15
|
@counter = counter
|
@@ -20,14 +20,6 @@ module Blacklight
|
|
20
20
|
presenter.thumbnail.exists?
|
21
21
|
end
|
22
22
|
|
23
|
-
def use_thumbnail_tag_behavior?
|
24
|
-
!presenter.thumbnail.instance_of?(Blacklight::ThumbnailPresenter)
|
25
|
-
end
|
26
|
-
|
27
|
-
def warn_about_deprecated_behavior
|
28
|
-
Deprecation.warn(Blacklight::Document::ThumbnailComponent, 'Detected as custom thumbnail presenter; make sure it has a #render method that returns just the thumbnail image tag')
|
29
|
-
end
|
30
|
-
|
31
23
|
def presenter
|
32
24
|
@presenter ||= helpers.document_presenter(@document)
|
33
25
|
end
|
@@ -1,32 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'view_component/version'
|
4
|
-
|
5
3
|
module Blacklight
|
6
|
-
##
|
7
|
-
# A component for rendering a single document
|
8
|
-
#
|
9
|
-
# @note when subclassing this component, if you override the initializer,
|
10
|
-
# you must explicitly specify the counter variable `document_counter` even if you don't use it.
|
11
|
-
# Otherwise view_component will not provide the count value when calling the component.
|
12
|
-
#
|
13
|
-
# @see https://viewcomponent.org/guide/collections.html#collection-counter
|
14
|
-
#
|
15
|
-
# @example
|
16
|
-
# class MyDocumentComponent < Blacklight::DocumentComponent
|
17
|
-
# def initialize(document_counter: nil, **kwargs)
|
18
|
-
# super
|
19
|
-
# ... custom code ...
|
20
|
-
# end
|
21
|
-
# end
|
22
4
|
class DocumentComponent < Blacklight::Component
|
23
|
-
include Blacklight::ContentAreasShim
|
24
|
-
|
25
|
-
with_collection_parameter :document
|
26
|
-
|
27
|
-
# ViewComponent 3 changes iteration counters to begin at 0 rather than 1
|
28
|
-
COLLECTION_INDEX_OFFSET = ViewComponent::VERSION::MAJOR < 3 ? 0 : 1
|
29
|
-
|
30
5
|
# Content appearing before the document
|
31
6
|
renders_one :header
|
32
7
|
|
@@ -39,16 +14,17 @@ module Blacklight
|
|
39
14
|
|
40
15
|
# The document title with some reasonable default behavior
|
41
16
|
renders_one :title, (lambda do |*args, component: nil, **kwargs|
|
42
|
-
component ||=
|
17
|
+
component ||= Blacklight::DocumentTitleComponent
|
43
18
|
|
44
|
-
component.new(*args, counter: @counter, document: @document, presenter: @presenter, as: @title_component, link_to_document: !@show, document_component: self, **kwargs)
|
19
|
+
component.new(*args, counter: @counter, document: @document, presenter: @presenter, as: @title_component, actions: !@show, link_to_document: !@show, document_component: self, **kwargs)
|
45
20
|
end)
|
46
21
|
|
47
22
|
renders_one :embed, (lambda do |static_content = nil, *args, component: nil, **kwargs|
|
48
23
|
next static_content if static_content.present?
|
49
|
-
next unless component
|
50
24
|
|
51
|
-
|
25
|
+
component ||= @presenter.view_config&.embed_component
|
26
|
+
|
27
|
+
next unless component
|
52
28
|
|
53
29
|
component.new(*args, document: @document, presenter: @presenter, document_counter: @document_counter, **kwargs)
|
54
30
|
end)
|
@@ -57,9 +33,7 @@ module Blacklight
|
|
57
33
|
renders_one :metadata, (lambda do |static_content = nil, *args, component: nil, fields: nil, **kwargs|
|
58
34
|
next static_content if static_content.present?
|
59
35
|
|
60
|
-
|
61
|
-
|
62
|
-
component ||= presenter&.view_config&.metadata_component || Blacklight::DocumentMetadataComponent
|
36
|
+
component ||= Blacklight::DocumentMetadataComponent
|
63
37
|
|
64
38
|
component.new(*args, fields: fields || @presenter&.field_presenters || [], **kwargs)
|
65
39
|
end)
|
@@ -70,8 +44,7 @@ module Blacklight
|
|
70
44
|
renders_one :thumbnail, (lambda do |image_options_or_static_content = {}, *args, component: nil, **kwargs|
|
71
45
|
next image_options_or_static_content if image_options_or_static_content.is_a? String
|
72
46
|
|
73
|
-
component ||= presenter&.view_config&.thumbnail_component || Blacklight::Document::ThumbnailComponent
|
74
|
-
Deprecation.warn(Blacklight::DocumentComponent, 'Pass the presenter to the DocumentComponent') if !component && @presenter.nil?
|
47
|
+
component ||= @presenter&.view_config&.thumbnail_component || Blacklight::Document::ThumbnailComponent
|
75
48
|
|
76
49
|
component.new(*args, document: @document, presenter: @presenter, counter: @counter, image_options: image_options_or_static_content, **kwargs)
|
77
50
|
end)
|
@@ -88,7 +61,6 @@ module Blacklight
|
|
88
61
|
# rubocop:disable Metrics/ParameterLists
|
89
62
|
# @param document [Blacklight::Document]
|
90
63
|
# @param presenter [Blacklight::DocumentPresenter]
|
91
|
-
# @param partials [Array, nil] view partial names that should be used to provide content for the `partials` slot
|
92
64
|
# @param id [String] HTML id for the root element
|
93
65
|
# @param classes [Array, String] additional HTML classes for the root element
|
94
66
|
# @param component [Symbol, String] HTML tag type to use for the root element
|
@@ -97,45 +69,27 @@ module Blacklight
|
|
97
69
|
# @param document_counter [Number, nil] alternatively, the document's position in a collection and,
|
98
70
|
# @param counter_offset [Number] with `document_counter`, the offset of the start of that collection counter to the overall result set
|
99
71
|
# @param show [Boolean] are we showing only a single document (vs a list of search results); used for backwards-compatibility
|
100
|
-
def initialize(document: nil, presenter: nil,
|
72
|
+
def initialize(document: nil, presenter: nil,
|
101
73
|
id: nil, classes: [], component: :article, title_component: nil,
|
102
|
-
metadata_component: nil,
|
103
|
-
embed_component: nil,
|
104
|
-
thumbnail_component: nil,
|
105
74
|
counter: nil, document_counter: nil, counter_offset: 0,
|
106
|
-
show: false
|
75
|
+
show: false)
|
107
76
|
if presenter.nil? && document.nil?
|
108
77
|
raise ArgumentError, 'missing keyword: :document or :presenter'
|
109
78
|
end
|
110
79
|
|
111
|
-
|
112
|
-
|
113
|
-
@document = @presenter.document || args[self.class.collection_parameter]
|
114
|
-
else
|
115
|
-
@document = document || presenter&.document || args[self.class.collection_parameter]
|
116
|
-
@presenter = presenter
|
117
|
-
end
|
80
|
+
@document = document || presenter&.document
|
81
|
+
@presenter = presenter
|
118
82
|
|
119
83
|
@component = component
|
120
84
|
@title_component = title_component
|
121
85
|
@id = id || ('document' if show)
|
122
86
|
@classes = classes
|
123
87
|
|
124
|
-
|
125
|
-
@embed_component = embed_component
|
126
|
-
|
127
|
-
Deprecation.warn(Blacklight::DocumentComponent, 'Passing metadata_component is deprecated') if @metadata_component.present?
|
128
|
-
@metadata_component = metadata_component
|
129
|
-
|
130
|
-
Deprecation.warn(Blacklight::DocumentComponent, 'Passing thumbnail_component is deprecated') if @thumbnail_component.present?
|
131
|
-
@thumbnail_component = thumbnail_component
|
132
|
-
|
88
|
+
@document_counter = document_counter
|
133
89
|
@counter = counter
|
134
|
-
@
|
135
|
-
@counter ||= @document_counter + COLLECTION_INDEX_OFFSET + counter_offset if @document_counter.present?
|
90
|
+
@counter ||= document_counter + 1 + counter_offset if document_counter.present?
|
136
91
|
|
137
92
|
@show = show
|
138
|
-
@view_partials = partials
|
139
93
|
end
|
140
94
|
# rubocop:enable Metrics/ParameterLists
|
141
95
|
|
@@ -151,29 +105,13 @@ module Blacklight
|
|
151
105
|
|
152
106
|
def before_render
|
153
107
|
set_slot(:title, nil) unless title
|
154
|
-
set_slot(:thumbnail, nil
|
155
|
-
set_slot(:metadata, nil,
|
156
|
-
set_slot(:embed, nil
|
157
|
-
|
158
|
-
# Blacklight 8 allows applications to pass in the partials to render instead of requiring the template to render the slots.
|
159
|
-
if partials.empty? && view_partials.present? # rubocop:disable Style/GuardClause
|
160
|
-
@render_partials = true
|
161
|
-
view_partials.each do |view_partial|
|
162
|
-
with_partial(view_partial) do
|
163
|
-
helpers.render_document_partial @document, view_partial, component: self, document_counter: @counter
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
def render_partials?
|
170
|
-
@render_partials || presenter.view_config&.render_partials_in_component?
|
108
|
+
set_slot(:thumbnail, nil) unless thumbnail || show?
|
109
|
+
set_slot(:metadata, nil, fields: presenter.field_presenters) unless metadata
|
110
|
+
set_slot(:embed, nil) unless embed
|
171
111
|
end
|
172
112
|
|
173
113
|
private
|
174
114
|
|
175
|
-
attr_reader :view_partials
|
176
|
-
|
177
115
|
def presenter
|
178
116
|
@presenter ||= helpers.document_presenter(@document)
|
179
117
|
end
|
@@ -3,25 +3,22 @@
|
|
3
3
|
module Blacklight
|
4
4
|
class DocumentMetadataComponent < Blacklight::Component
|
5
5
|
renders_many :fields, (lambda do |component: nil, **kwargs|
|
6
|
-
|
6
|
+
component.new(**kwargs)
|
7
7
|
end)
|
8
8
|
with_collection_parameter :fields
|
9
9
|
|
10
10
|
# @param fields [Enumerable<Blacklight::FieldPresenter>] Document field presenters
|
11
|
-
def initialize(fields: [],
|
11
|
+
def initialize(fields: [], show: false, view_type: nil)
|
12
12
|
@fields = fields
|
13
|
-
@tag = tag
|
14
|
-
@classes = classes
|
15
13
|
@show = show
|
16
|
-
@
|
17
|
-
@component_args = component_args
|
14
|
+
@view_type = view_type
|
18
15
|
end
|
19
16
|
|
20
17
|
def before_render
|
21
18
|
return unless fields
|
22
19
|
|
23
20
|
@fields.each do |field|
|
24
|
-
|
21
|
+
field(component: field.component, field: field, show: @show, view_type: @view_type)
|
25
22
|
end
|
26
23
|
end
|
27
24
|
|
@@ -29,8 +26,6 @@ module Blacklight
|
|
29
26
|
fields.present?
|
30
27
|
end
|
31
28
|
|
32
|
-
|
33
|
-
field&.component || Blacklight::MetadataFieldComponent
|
34
|
-
end
|
29
|
+
attr_reader :view_type
|
35
30
|
end
|
36
31
|
end
|
@@ -11,7 +11,7 @@ module Blacklight
|
|
11
11
|
# @param [Blacklight::Solr::Response::Facets::FacetField] display_facet
|
12
12
|
# @param [Blacklight::Configuration] blacklight_config
|
13
13
|
# @param [Boolean] layout
|
14
|
-
# rubocop:disable Metrics/ParameterLists
|
14
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/ParameterLists
|
15
15
|
def initialize(display_facet_or_field_config: nil, display_facet: nil, field_config: nil, response: nil, blacklight_config: nil, component: nil, **component_args)
|
16
16
|
if display_facet_or_field_config.is_a? Blacklight::FacetFieldPresenter
|
17
17
|
@facet_field_presenter = display_facet_or_field_config
|
@@ -30,10 +30,10 @@ module Blacklight
|
|
30
30
|
raise ArgumentError, 'You must provide one of display_facet or field_config' unless @field_config
|
31
31
|
end
|
32
32
|
|
33
|
-
@component = component ||
|
33
|
+
@component = component || @field_config.component
|
34
34
|
@component_args = component_args
|
35
35
|
end
|
36
|
-
# rubocop:enable Metrics/ParameterLists
|
36
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/ParameterLists
|
37
37
|
|
38
38
|
def render?
|
39
39
|
helpers.should_render_field?(@field_config, @display_facet)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%= render(@layout.new(facet_field: @facet_field)) do |component| %>
|
2
|
-
<% component.
|
2
|
+
<% component.label do %>
|
3
3
|
<%= @facet_field.label %>
|
4
4
|
<% end %>
|
5
5
|
|
6
|
-
<% component.
|
6
|
+
<% component.body do %>
|
7
7
|
<ul class="facet-values list-unstyled blacklight-facet-checkboxes">
|
8
8
|
<% presenters.each_with_index do |presenter, idx| -%>
|
9
9
|
<li>
|
@@ -11,12 +11,12 @@
|
|
11
11
|
<%= check_box_tag "f_inclusive[#{@facet_field.key}][]", presenter.value, presenter.selected?, id: "f_inclusive_#{@facet_field.key}_#{idx}"%>
|
12
12
|
</span>
|
13
13
|
|
14
|
-
<span
|
14
|
+
<span>
|
15
15
|
<%= label_tag "f_inclusive_#{@facet_field.key}_#{idx}" do %>
|
16
16
|
<span class="facet-label"><%= presenter.label %></span>
|
17
17
|
<span class="facet-count"><%= t('blacklight.search.facets.count', number: number_with_delimiter(presenter.hits)) %></span>
|
18
18
|
<% end %>
|
19
|
-
|
19
|
+
<span>
|
20
20
|
</li>
|
21
21
|
<% end -%>
|
22
22
|
</ul>
|
@@ -17,7 +17,7 @@ module Blacklight
|
|
17
17
|
return to_enum(:presenters) unless block_given?
|
18
18
|
|
19
19
|
@facet_field.paginator.items.each do |item|
|
20
|
-
yield
|
20
|
+
yield @facet_field.facet_field.item_presenter.new(item, @facet_field.facet_field, helpers, @facet_field.key, @facet_field.search_state)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -1,19 +1,18 @@
|
|
1
1
|
<div class="card facet-limit blacklight-<%= @facet_field.key %> <%= 'facet-limit-active' if @facet_field.active? %>">
|
2
|
-
<h3 class="card-header p-0 facet-field-heading" id="<%=
|
2
|
+
<h3 class="card-header p-0 facet-field-heading" id="<%= header_html_id %>">
|
3
3
|
<button
|
4
4
|
type="button"
|
5
5
|
class="btn w-100 d-block btn-block p-2 text-start text-left collapse-toggle <%= "collapsed" if @facet_field.collapsed? %>"
|
6
6
|
data-toggle="collapse"
|
7
7
|
data-bs-toggle="collapse"
|
8
|
-
data-target="#<%=
|
9
|
-
data-bs-target="#<%=
|
8
|
+
data-target="#<%= html_id %>"
|
9
|
+
data-bs-target="#<%= html_id %>"
|
10
10
|
aria-expanded="<%= @facet_field.collapsed? ? 'false' : 'true' %>"
|
11
|
-
arial-controls="<%= @facet_field.html_id %>"
|
12
11
|
>
|
13
12
|
<%= label %>
|
14
13
|
</button>
|
15
14
|
</h3>
|
16
|
-
<div id="<%=
|
15
|
+
<div id="<%= html_id %>" aria-labelledby="<%= header_html_id %>" class="panel-collapse facet-content collapse <%= "show" unless @facet_field.collapsed? %>">
|
17
16
|
<div class="card-body">
|
18
17
|
<%= body %>
|
19
18
|
|
@@ -2,13 +2,20 @@
|
|
2
2
|
|
3
3
|
module Blacklight
|
4
4
|
class FacetFieldComponent < Blacklight::Component
|
5
|
-
include Blacklight::ContentAreasShim
|
6
|
-
|
7
5
|
renders_one :label
|
8
6
|
renders_one :body
|
9
7
|
|
8
|
+
# @param [Blacklight::FacetFieldPresenter] facet_field
|
10
9
|
def initialize(facet_field:)
|
11
10
|
@facet_field = facet_field
|
12
11
|
end
|
12
|
+
|
13
|
+
def html_id
|
14
|
+
"facet-#{@facet_field.key.parameterize}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def header_html_id
|
18
|
+
"#{html_id}-header"
|
19
|
+
end
|
13
20
|
end
|
14
21
|
end
|