geoblacklight_admin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +18 -0
- data/.gitignore +75 -0
- data/.standard.yml +4 -0
- data/Gemfile +59 -0
- data/LICENSE +21 -0
- data/README.md +84 -0
- data/Rakefile +72 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/images/aerial_photo.jpg +0 -0
- data/app/assets/images/archive-solid.svg +1 -0
- data/app/assets/images/bookmark-regular.svg +1 -0
- data/app/assets/images/bookmark-solid.svg +1 -0
- data/app/assets/images/btaa-logo.jpg +0 -0
- data/app/assets/images/cloud-download-alt-solid.svg +1 -0
- data/app/assets/images/file-import-solid.svg +1 -0
- data/app/assets/images/trash-alt-solid.svg +1 -0
- data/app/assets/javascripts/geoblacklight_admin/chosen.js +4 -0
- data/app/assets/javascripts/geoblacklight_admin/date_range_picker.js +173 -0
- data/app/assets/javascripts/geoblacklight_admin/datepicker.js +22 -0
- data/app/assets/javascripts/geoblacklight_admin/elements.js +38 -0
- data/app/assets/javascripts/geoblacklight_admin/exports.js +3 -0
- data/app/assets/javascripts/geoblacklight_admin/fields.js +11 -0
- data/app/assets/javascripts/geoblacklight_admin/geoblacklight_admin.js +2 -0
- data/app/assets/javascripts/geoblacklight_admin/inputmask.js +4 -0
- data/app/assets/javascripts/geoblacklight_admin/locale.js +5 -0
- data/app/assets/javascripts/geoblacklight_admin/sortable.js +2544 -0
- data/app/assets/javascripts/geoblacklight_admin/tooltips.js +3 -0
- data/app/assets/javascripts/geoblacklight_admin/truncate.js +4 -0
- data/app/assets/javascripts/geoblacklight_admin.js +40 -0
- data/app/assets/stylesheets/geoblacklight_admin/_core.scss +47 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_autocomplete.scss +32 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_blazer.scss +3 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_code.scss +3 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_datepicker.scss +477 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_elements.scss +3 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_forms.scss +28 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_icons.scss +15 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_nav.scss +9 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_tables.scss +4 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_toasts.scss +7 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_visibility.scss +3 -0
- data/app/assets/stylesheets/geoblacklight_admin/settings/_variables.scss +1 -0
- data/app/channels/export_channel.rb +12 -0
- data/app/controllers/admin/admin_controller.rb +16 -0
- data/app/controllers/admin/advanced_search_controller.rb +365 -0
- data/app/controllers/admin/api_controller.rb +386 -0
- data/app/controllers/admin/bookmarks_controller.rb +68 -0
- data/app/controllers/admin/bulk_actions_controller.rb +94 -0
- data/app/controllers/admin/concerns/.keep +0 -0
- data/app/controllers/admin/concerns/upload_util.rb +8 -0
- data/app/controllers/admin/document_accesses_controller.rb +125 -0
- data/app/controllers/admin/document_assets_controller.rb +198 -0
- data/app/controllers/admin/document_downloads_controller.rb +127 -0
- data/app/controllers/admin/documents_controller.rb +219 -0
- data/app/controllers/admin/elements_controller.rb +81 -0
- data/app/controllers/admin/form_elements_controller.rb +81 -0
- data/app/controllers/admin/ids_controller.rb +379 -0
- data/app/controllers/admin/import_documents_controller.rb +18 -0
- data/app/controllers/admin/imports_controller.rb +105 -0
- data/app/controllers/admin/mappings_controller.rb +95 -0
- data/app/controllers/admin/notifications_controller.rb +51 -0
- data/app/controllers/admin/search_controller.rb +10 -0
- data/app/controllers/admin/users_controller.rb +10 -0
- data/app/helpers/bulk_actions_helper.rb +9 -0
- data/app/helpers/document_helper.rb +60 -0
- data/app/helpers/form_input_helper.rb +73 -0
- data/app/helpers/geoblacklight_admin_helper.rb +118 -0
- data/app/helpers/import_documents_helper.rb +5 -0
- data/app/helpers/mappings_helper.rb +27 -0
- data/app/indexers/document_indexer.rb +34 -0
- data/app/jobs/bulk_action_revert_document_job.rb +49 -0
- data/app/jobs/bulk_action_revert_job.rb +25 -0
- data/app/jobs/bulk_action_run_document_job.rb +42 -0
- data/app/jobs/bulk_action_run_job.rb +27 -0
- data/app/jobs/export_job.rb +72 -0
- data/app/jobs/export_json_job.rb +120 -0
- data/app/jobs/import_document_job.rb +25 -0
- data/app/jobs/import_run_job.rb +33 -0
- data/app/models/active_storage_attachment.rb +5 -0
- data/app/models/active_storage_blob.rb +5 -0
- data/app/models/api_search_builder.rb +12 -0
- data/app/models/application_record.rb +6 -0
- data/app/models/blacklight_api.rb +93 -0
- data/app/models/blacklight_api_facets.rb +15 -0
- data/app/models/blacklight_api_ids.rb +103 -0
- data/app/models/bookmark.rb +17 -0
- data/app/models/bulk_action.rb +88 -0
- data/app/models/bulk_action_document.rb +22 -0
- data/app/models/bulk_action_document_state_machine.rb +16 -0
- data/app/models/bulk_action_document_transition.rb +19 -0
- data/app/models/bulk_action_state_machine.rb +16 -0
- data/app/models/bulk_action_transition.rb +26 -0
- data/app/models/concerns/.keep +0 -0
- data/app/models/document/bbox_validator.rb +70 -0
- data/app/models/document/controlled_lists.rb +104 -0
- data/app/models/document/date_range_validator.rb +63 -0
- data/app/models/document/geom_validator.rb +117 -0
- data/app/models/document/reference.rb +107 -0
- data/app/models/document.rb +264 -0
- data/app/models/document_access.rb +35 -0
- data/app/models/document_download.rb +35 -0
- data/app/models/document_state_machine.rb +14 -0
- data/app/models/document_transition.rb +26 -0
- data/app/models/element.rb +90 -0
- data/app/models/form_control.rb +2 -0
- data/app/models/form_element.rb +19 -0
- data/app/models/form_feature.rb +2 -0
- data/app/models/form_group.rb +2 -0
- data/app/models/form_header.rb +2 -0
- data/app/models/geoblacklight_admin/field_mappings_btaa_aardvark.rb +379 -0
- data/app/models/geoblacklight_admin/field_mappings_gblv1.rb +344 -0
- data/app/models/geoblacklight_admin/iso_language_codes.rb +515 -0
- data/app/models/geoblacklight_admin/schema.rb +194 -0
- data/app/models/geoblacklight_admin.rb +3 -0
- data/app/models/import/csv_duplicates_validator.rb +36 -0
- data/app/models/import/csv_header_validator.rb +24 -0
- data/app/models/import.rb +186 -0
- data/app/models/import_btaa.rb +91 -0
- data/app/models/import_btaa_aardvark.rb +109 -0
- data/app/models/import_document.rb +34 -0
- data/app/models/import_document_state_machine.rb +12 -0
- data/app/models/import_document_transition.rb +19 -0
- data/app/models/import_gblv1.rb +92 -0
- data/app/models/import_state_machine.rb +16 -0
- data/app/models/import_transition.rb +26 -0
- data/app/models/mapping.rb +10 -0
- data/app/models/notification.rb +9 -0
- data/app/models/user.rb +26 -0
- data/app/notifications/export_notification.rb +30 -0
- data/app/services/export_csv_document_access_links_service.rb +47 -0
- data/app/services/export_csv_document_downloads_service.rb +47 -0
- data/app/services/export_csv_service.rb +44 -0
- data/app/services/export_json_service.rb +35 -0
- data/app/services/zip_file_generator.rb +56 -0
- data/app/views/admin/advanced_search/facets.json.jbuilder +80 -0
- data/app/views/admin/advanced_search/index.json.jbuilder +90 -0
- data/app/views/admin/api/_field.json.jbuilder +10 -0
- data/app/views/admin/api/fetch.json.jbuilder +86 -0
- data/app/views/admin/api/index.json.jbuilder +90 -0
- data/app/views/admin/bookmarks/_bookmark.json.jbuilder +4 -0
- data/app/views/admin/bookmarks/create.js.erb +7 -0
- data/app/views/admin/bookmarks/destroy.js.erb +7 -0
- data/app/views/admin/bookmarks/index.html.erb +21 -0
- data/app/views/admin/bookmarks/index.json.jbuilder +3 -0
- data/app/views/admin/bulk_actions/_bulk_action.json.jbuilder +4 -0
- data/app/views/admin/bulk_actions/_form.html.erb +17 -0
- data/app/views/admin/bulk_actions/edit.html.erb +6 -0
- data/app/views/admin/bulk_actions/index.html.erb +54 -0
- data/app/views/admin/bulk_actions/index.json.jbuilder +3 -0
- data/app/views/admin/bulk_actions/new.html.erb +5 -0
- data/app/views/admin/bulk_actions/show.html.erb +100 -0
- data/app/views/admin/bulk_actions/show.json.jbuilder +3 -0
- data/app/views/admin/devise/confirmations/new.html.erb +16 -0
- data/app/views/admin/devise/invitations/edit.html.erb +15 -0
- data/app/views/admin/devise/invitations/new.html.erb +15 -0
- data/app/views/admin/devise/mailer/invitation_instructions.html.erb +11 -0
- data/app/views/admin/devise/mailer/invitation_instructions.text.erb +11 -0
- data/app/views/admin/devise/passwords/edit.html.erb +26 -0
- data/app/views/admin/devise/passwords/new.html.erb +16 -0
- data/app/views/admin/devise/registrations/edit.html.erb +35 -0
- data/app/views/admin/devise/registrations/new.html.erb +30 -0
- data/app/views/admin/devise/sessions/new.html.erb +28 -0
- data/app/views/admin/devise/shared/_links.html.erb +27 -0
- data/app/views/admin/devise/unlocks/new.html.erb +16 -0
- data/app/views/admin/document_accesses/_document_access.json.jbuilder +4 -0
- data/app/views/admin/document_accesses/_form.html.erb +17 -0
- data/app/views/admin/document_accesses/destroy_all.html.erb +70 -0
- data/app/views/admin/document_accesses/edit.html.erb +5 -0
- data/app/views/admin/document_accesses/import.html.erb +70 -0
- data/app/views/admin/document_accesses/index.html.erb +74 -0
- data/app/views/admin/document_accesses/index.json.jbuilder +3 -0
- data/app/views/admin/document_accesses/new.html.erb +6 -0
- data/app/views/admin/document_accesses/show.html.erb +19 -0
- data/app/views/admin/document_accesses/show.json.jbuilder +3 -0
- data/app/views/admin/document_assets/display_attach_form.html.erb +44 -0
- data/app/views/admin/document_assets/index.html.erb +65 -0
- data/app/views/admin/document_downloads/_document_download.json.jbuilder +4 -0
- data/app/views/admin/document_downloads/_form.html.erb +15 -0
- data/app/views/admin/document_downloads/destroy_all.html.erb +70 -0
- data/app/views/admin/document_downloads/edit.html.erb +6 -0
- data/app/views/admin/document_downloads/import.html.erb +74 -0
- data/app/views/admin/document_downloads/index.html.erb +70 -0
- data/app/views/admin/document_downloads/index.json.jbuilder +3 -0
- data/app/views/admin/document_downloads/new.html.erb +5 -0
- data/app/views/admin/document_downloads/show.html.erb +24 -0
- data/app/views/admin/document_downloads/show.json.jbuilder +3 -0
- data/app/views/admin/documents/_document.html.erb +29 -0
- data/app/views/admin/documents/_document_bookmark.html.erb +17 -0
- data/app/views/admin/documents/_document_fields.html.erb +24 -0
- data/app/views/admin/documents/_form.html.erb +49 -0
- data/app/views/admin/documents/_form_control.html.erb +86 -0
- data/app/views/admin/documents/_form_group.html.erb +1 -0
- data/app/views/admin/documents/_form_header.html.erb +1 -0
- data/app/views/admin/documents/_form_nav.html.erb +21 -0
- data/app/views/admin/documents/_json_aardvark.jbuilder +47 -0
- data/app/views/admin/documents/_json_btaa_aardvark.jbuilder +16 -0
- data/app/views/admin/documents/_json_gbl_v1.jbuilder +32 -0
- data/app/views/admin/documents/_result_facets.html.erb +35 -0
- data/app/views/admin/documents/_result_pagination.html.erb +21 -0
- data/app/views/admin/documents/_result_selected_options.html.erb +54 -0
- data/app/views/admin/documents/_result_selection_options.html.erb +10 -0
- data/app/views/admin/documents/_result_toggle.html.erb +13 -0
- data/app/views/admin/documents/edit.html.erb +7 -0
- data/app/views/admin/documents/features/_assets.html.erb +3 -0
- data/app/views/admin/documents/features/_institutional_access_links.html.erb +3 -0
- data/app/views/admin/documents/features/_multiple_download_links.html.erb +27 -0
- data/app/views/admin/documents/fetch.json_aardvark.jbuilder +9 -0
- data/app/views/admin/documents/fetch.json_btaa_aardvark.jbuilder +9 -0
- data/app/views/admin/documents/fetch.json_gbl_v1.jbuilder +9 -0
- data/app/views/admin/documents/index.html.erb +49 -0
- data/app/views/admin/documents/index.json_aardvark.jbuilder +9 -0
- data/app/views/admin/documents/index.json_btaa_aardvark.jbuilder +9 -0
- data/app/views/admin/documents/index.json_gbl_v1.jbuilder +9 -0
- data/app/views/admin/documents/show.json_aardvark.jbuilder +3 -0
- data/app/views/admin/documents/show.json_btaa_aardvark.jbuilder +3 -0
- data/app/views/admin/documents/show.json_gbl_v1.jbuilder +3 -0
- data/app/views/admin/documents/versions.html.erb +110 -0
- data/app/views/admin/elements/_element.json.jbuilder +2 -0
- data/app/views/admin/elements/_form.html.erb +45 -0
- data/app/views/admin/elements/edit.html.erb +6 -0
- data/app/views/admin/elements/index.html.erb +68 -0
- data/app/views/admin/elements/index.json.jbuilder +1 -0
- data/app/views/admin/elements/new.html.erb +5 -0
- data/app/views/admin/elements/show.html.erb +121 -0
- data/app/views/admin/elements/show.json.jbuilder +1 -0
- data/app/views/admin/form_elements/_form.html.erb +46 -0
- data/app/views/admin/form_elements/_form_element.json.jbuilder +2 -0
- data/app/views/admin/form_elements/edit.html.erb +6 -0
- data/app/views/admin/form_elements/index.html.erb +49 -0
- data/app/views/admin/form_elements/index.json.jbuilder +1 -0
- data/app/views/admin/form_elements/new.html.erb +5 -0
- data/app/views/admin/form_elements/show.html.erb +19 -0
- data/app/views/admin/form_elements/show.json.jbuilder +1 -0
- data/app/views/admin/ids/fetch.json.jbuilder +86 -0
- data/app/views/admin/ids/index.json.jbuilder +41 -0
- data/app/views/admin/import_documents/show.html.haml +20 -0
- data/app/views/admin/imports/_form.html.erb +27 -0
- data/app/views/admin/imports/_import.json.jbuilder +4 -0
- data/app/views/admin/imports/_show_failed_tab.html.erb +37 -0
- data/app/views/admin/imports/_show_success_tab.html.erb +31 -0
- data/app/views/admin/imports/edit.html.erb +8 -0
- data/app/views/admin/imports/index.html.erb +56 -0
- data/app/views/admin/imports/index.json.jbuilder +3 -0
- data/app/views/admin/imports/new.html.erb +7 -0
- data/app/views/admin/imports/show.html.erb +123 -0
- data/app/views/admin/imports/show.json.jbuilder +3 -0
- data/app/views/admin/layouts/application.html.erb +30 -0
- data/app/views/admin/layouts/blazer/application.html.erb +23 -0
- data/app/views/admin/layouts/mailer.html.erb +13 -0
- data/app/views/admin/layouts/mailer.text.erb +1 -0
- data/app/views/admin/mappings/_form.html.erb +17 -0
- data/app/views/admin/mappings/_mapping.json.jbuilder +4 -0
- data/app/views/admin/mappings/edit.html.erb +6 -0
- data/app/views/admin/mappings/index.html.erb +37 -0
- data/app/views/admin/mappings/index.json.jbuilder +3 -0
- data/app/views/admin/mappings/new.html.erb +5 -0
- data/app/views/admin/mappings/show.html.erb +27 -0
- data/app/views/admin/mappings/show.json.jbuilder +3 -0
- data/app/views/admin/notifications/_notification.html.haml +31 -0
- data/app/views/admin/notifications/index.html.erb +54 -0
- data/app/views/admin/notifications/update.js.erb +7 -0
- data/app/views/admin/search/index.html.erb +38 -0
- data/app/views/admin/shared/_flash_messages.html.erb +5 -0
- data/app/views/admin/shared/_footer.html.erb +56 -0
- data/app/views/admin/shared/_js_behaviors.html.erb +147 -0
- data/app/views/admin/shared/_navbar.html.erb +78 -0
- data/app/views/admin/shared/_navbar_blazer.html.erb +42 -0
- data/app/views/admin/shared/_schema_timestamp.html.erb +16 -0
- data/app/views/admin/shared/_toast.html.erb +13 -0
- data/app/views/admin/users/index.html.erb +21 -0
- data/config/authorities/formats.yml +25 -0
- data/config/authorities/languages.yml +50 -0
- data/config/authorities/resource_type.yml +82 -0
- data/config/blazer.yml +79 -0
- data/config/gbl_v1_schema.json +118 -0
- data/config/geomg_aardvark_schema.json +211 -0
- data/config/geomg_schema.json +123 -0
- data/config/locales/devise.en.yml +65 -0
- data/config/locales/devise_invitable.en.yml +31 -0
- data/config/locales/documents.en.yml +189 -0
- data/config/locales/en.yml +51 -0
- data/config/locales/geoblacklight.en.yml +178 -0
- data/config/locales/simple_form.en.yml +31 -0
- data/config/routes.rb +162 -0
- data/db/migrate/20230316183001_add_geoblacklight_admin.rb +399 -0
- data/db/seeds.rb +26 -0
- data/db/seeds_elements.csv +56 -0
- data/db/seeds_elements.numbers +0 -0
- data/db/seeds_form_elements.csv +71 -0
- data/db/seeds_form_elements.numbers +0 -0
- data/db/structure.sql +816 -0
- data/geoblacklight_admin.gemspec +67 -0
- data/lib/generators/geoblacklight_admin/config_generator.rb +336 -0
- data/lib/generators/geoblacklight_admin/example_docs_generator.rb +18 -0
- data/lib/generators/geoblacklight_admin/helpers_generator.rb +18 -0
- data/lib/generators/geoblacklight_admin/install_generator.rb +60 -0
- data/lib/generators/geoblacklight_admin/jobs_generator.rb +21 -0
- data/lib/generators/geoblacklight_admin/models_generator.rb +23 -0
- data/lib/generators/geoblacklight_admin/templates/.env.development.example +28 -0
- data/lib/generators/geoblacklight_admin/templates/.solr_wrapper.yml +7 -0
- data/lib/generators/geoblacklight_admin/templates/_user_util_links.html.erb +30 -0
- data/lib/generators/geoblacklight_admin/templates/config/database.yml +18 -0
- data/lib/generators/geoblacklight_admin/templates/config/geomg_aardvark_schema.json +211 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/geoblacklight_admin.rb +25 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/kithe.rb +31 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/pagy.rb +158 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/statesman.rb +7 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/channels/consumer.js +6 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/channels/export_channel.js +30 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/channels/index.js +5 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/controllers/application_controller.js +17 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/controllers/document_controller.js +26 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/controllers/index.js +10 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/controllers/results_controller.js +310 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/packs/application.js +23 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/src/js/admin/qa_autocomplete.js +1134 -0
- data/lib/generators/geoblacklight_admin/templates/package.json +32 -0
- data/lib/generators/geoblacklight_admin/templates/solr/README-geoblacklight-solr-development.txt +3 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/_rest_managed.json +3 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/admin-extra.html +31 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/core.properties +5 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/elevate.xml +36 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/protwords.txt +21 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/schema.xml +229 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/scripts.conf +24 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/solrconfig.xml +266 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/spellings.txt +2 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/stopwords.txt +58 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/stopwords_en.txt +58 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/synonyms.txt +43 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/example.xsl +132 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/example_atom.xsl +67 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/example_rss.xsl +66 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/luke.xsl +337 -0
- data/lib/generators/geoblacklight_admin/templates/solr/snapshots/.keep +0 -0
- data/lib/generators/geoblacklight_admin/views_generator.rb +19 -0
- data/lib/geoblacklight_admin/engine.rb +20 -0
- data/lib/geoblacklight_admin/version.rb +5 -0
- data/lib/geoblacklight_admin.rb +7 -0
- data/lib/tasks/.keep +0 -0
- data/lib/tasks/geoblacklight_admin.rake +209 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +35 -0
- data/template.rb +16 -0
- metadata +1037 -0
@@ -0,0 +1,386 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'blacklight/catalog'
|
3
|
+
|
4
|
+
# Admin::ApiController
|
5
|
+
module Admin
|
6
|
+
class ApiController < ApplicationController
|
7
|
+
include Blacklight::Catalog
|
8
|
+
include BlacklightAdvancedSearch::Controller
|
9
|
+
|
10
|
+
# @TODO
|
11
|
+
# include ::BlacklightRangeLimit::ControllerOverride
|
12
|
+
|
13
|
+
configure_blacklight do |config|
|
14
|
+
# special search builder
|
15
|
+
config.search_builder_class = ::ApiSearchBuilder
|
16
|
+
|
17
|
+
# default advanced config values
|
18
|
+
config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
|
19
|
+
|
20
|
+
# Blacklight update to 7.0.0
|
21
|
+
config.add_results_document_tool(:bookmark, partial: 'bookmark_control', if: :render_bookmarks_control?)
|
22
|
+
|
23
|
+
config.add_results_collection_tool(:sort_widget)
|
24
|
+
config.add_results_collection_tool(:per_page_widget)
|
25
|
+
config.add_results_collection_tool(:view_type_group)
|
26
|
+
|
27
|
+
config.add_show_tools_partial(:bookmark, partial: 'bookmark_control', if: :render_bookmarks_control?)
|
28
|
+
config.add_show_tools_partial(:email, callback: :email_action, validator: :validate_email_params)
|
29
|
+
config.add_show_tools_partial(:sms, if: :render_sms_action?, callback: :sms_action, validator: :validate_sms_params)
|
30
|
+
|
31
|
+
config.add_nav_action(:bookmark, partial: 'blacklight/nav/bookmark', if: :render_bookmarks_control?)
|
32
|
+
# Blacklight update to 7.0.0
|
33
|
+
|
34
|
+
# Advanced config values
|
35
|
+
config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
|
36
|
+
config.advanced_search[:url_key] ||= 'advanced'
|
37
|
+
config.advanced_search[:query_parser] ||= 'edismax'
|
38
|
+
config.advanced_search[:form_solr_parameters] ||= {}
|
39
|
+
config.advanced_search[:form_solr_parameters]['facet.field'] ||= [Settings.FIELDS.PROVIDER, Settings.FIELDS.B1G_CODE, Settings.FIELDS.MEMBER_OF, Settings.FIELDS.IS_PART_OF, Settings.FIELDS.RESOURCE_CLASS, Settings.FIELDS.RESOURCE_TYPE, Settings.FIELDS.SUBJECT, Settings.FIELDS.THEME, Settings.FIELDS.FORMAT, Settings.FIELDS.SUPPRESSED, Settings.FIELDS.B1G_CHILD_RECORD, Settings.FIELDS.GEOREFERENCED]
|
40
|
+
config.advanced_search[:form_solr_parameters]['facet.query'] ||= ''
|
41
|
+
config.advanced_search[:form_solr_parameters]['facet.limit'] ||= -1
|
42
|
+
config.advanced_search[:form_solr_parameters]['facet.sort'] ||= 'index'
|
43
|
+
|
44
|
+
# Map views
|
45
|
+
config.view.mapview.partials = [:index]
|
46
|
+
config.view['split'].title = "List view"
|
47
|
+
config.view['mapview'].title = "Map view"
|
48
|
+
|
49
|
+
config.raw_endpoint.enabled = true
|
50
|
+
|
51
|
+
## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
|
52
|
+
config.default_solr_params = {
|
53
|
+
:start => 0,
|
54
|
+
'q.alt' => '*:*',
|
55
|
+
'admin.api' => true
|
56
|
+
}
|
57
|
+
|
58
|
+
# @TODO
|
59
|
+
# Merge B1G field into default_solr_params
|
60
|
+
# 'bf' => ["if(exists(#{Settings.FIELDS.B1G_CHILD_RECORD}),0,100)^0.5"],
|
61
|
+
|
62
|
+
config.default_per_page = 20 # Works!
|
63
|
+
|
64
|
+
## Default parameters to send on single-document requests to Solr. These settings are the Blackligt defaults (see SolrHelper#solr_doc_params) or
|
65
|
+
## parameters included in the Blacklight-jetty document requestHandler.
|
66
|
+
#
|
67
|
+
config.default_document_solr_params = {
|
68
|
+
:qt => 'document',
|
69
|
+
:q => "{!raw f=#{Settings.FIELDS.B1G_GEOMG_ID} v=$id}"
|
70
|
+
}
|
71
|
+
|
72
|
+
# config.search_builder_class = Geoblacklight::SearchBuilder
|
73
|
+
|
74
|
+
# solr field configuration for search results/index views
|
75
|
+
# config.index.show_link = 'title_display'
|
76
|
+
# config.index.record_display_type = 'format'
|
77
|
+
|
78
|
+
config.index.title_field = Settings.FIELDS.TITLE
|
79
|
+
config.index.document_presenter_class = Geoblacklight::DocumentPresenter
|
80
|
+
|
81
|
+
# solr field configuration for document/show views
|
82
|
+
|
83
|
+
config.show.display_type_field = 'format'
|
84
|
+
|
85
|
+
# Custom GeoBlacklight fields which currently map to GeoBlacklight-Schema
|
86
|
+
# v0.3.2
|
87
|
+
config.wxs_identifier_field = Settings.FIELDS.WXS_IDENTIFIER
|
88
|
+
|
89
|
+
# solr fields that will be treated as facets by the blacklight application
|
90
|
+
# The ordering of the field names is the order of the display
|
91
|
+
#
|
92
|
+
# Setting a limit will trigger Blacklight's 'more' facet values link.
|
93
|
+
# * If left unset, then all facet values returned by solr will be displayed.
|
94
|
+
# * If set to an integer, then "f.somefield.facet.limit" will be added to
|
95
|
+
# solr request, with actual solr request being +1 your configured limit --
|
96
|
+
# you configure the number of items you actually want _displayed_ in a page.
|
97
|
+
# * If set to 'true', then no additional parameters will be sent to solr,
|
98
|
+
# but any 'sniffed' request limit parameters will be used for paging, with
|
99
|
+
# paging at requested limit -1. Can sniff from facet.limit or
|
100
|
+
# f.specific_field.facet.limit solr request params. This 'true' config
|
101
|
+
# can be used if you set limits in :default_solr_params, or as defaults
|
102
|
+
# on the solr side in the request handler itself. Request handler defaults
|
103
|
+
# sniffing requires solr requests to be made with "echoParams=all", for
|
104
|
+
# app code to actually have it echo'd back to see it.
|
105
|
+
#
|
106
|
+
# :show may be set to false if you don't want the facet to be drawn in the
|
107
|
+
# facet bar
|
108
|
+
# config.add_facet_field 'format', :label => 'Format'
|
109
|
+
# config.add_facet_field 'pub_date', :label => 'Publication Year', :single => true
|
110
|
+
# config.add_facet_field 'subject_topic_facet', :label => 'Topic', :limit => 20
|
111
|
+
# config.add_facet_field 'language_facet', :label => 'Language', :limit => true
|
112
|
+
# config.add_facet_field 'lc_1letter_facet', :label => 'Call Number'
|
113
|
+
# config.add_facet_field 'subject_geo_facet', :label => 'Region'
|
114
|
+
# config.add_facet_field 'solr_bbox', :fq => "solr_bbox:IsWithin(-88,26,-79,36)", :label => 'Spatial'
|
115
|
+
|
116
|
+
# config.add_facet_field 'example_pivot_field', :label => 'Pivot Field', :pivot => ['format', 'language_facet']
|
117
|
+
|
118
|
+
## FACETS
|
119
|
+
#
|
120
|
+
# Date Range Filter
|
121
|
+
# config.add_facet_field 'date_created_drsim', :label => 'Date Created', :show => false
|
122
|
+
|
123
|
+
# Date Created
|
124
|
+
# config.add_facet_field 'time_period', label: 'Date Created', query: {
|
125
|
+
# 'today' => { label: 'Today', fq: "date_created_drsim:[#{Date.today.beginning_of_day.to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{Date.today.end_of_day.to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"},
|
126
|
+
# 'this_week' => { label: 'This week', fq: "date_created_drsim:[#{(Date.today.end_of_day - 1.week).to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{Date.today.end_of_day.to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"},
|
127
|
+
# 'this_month' => { label: 'This month', fq: "date_created_drsim:[#{(Date.today.end_of_day - 1.month).to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{Date.today.end_of_day.to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"},
|
128
|
+
# 'last_month' => { label: 'Last month', fq: "date_created_drsim:[#{(Date.today.end_of_day - 2.months).to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{(Date.today.end_of_day - 1.month).to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"},
|
129
|
+
# 'this_quarter' => { label: 'This quarter', fq: "date_created_drsim:[#{(Date.today.end_of_day - 3.months).to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{(Date.today.end_of_day).to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"},
|
130
|
+
# 'this_year' => { label: 'This year', fq: "date_created_drsim:[#{(Date.today.end_of_day - 1.year).to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{(Date.today.end_of_day).to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"}
|
131
|
+
# }
|
132
|
+
|
133
|
+
# Publication State
|
134
|
+
# config.add_facet_field Settings.FIELDS.B1G_PUBLICATION_STATE, :label => 'Publication State', :limit => 8, collapse: false
|
135
|
+
|
136
|
+
# Resouce Class
|
137
|
+
config.add_facet_field Settings.FIELDS.RESOURCE_CLASS, label: 'Resource Class', limit: 8
|
138
|
+
|
139
|
+
# Contributor
|
140
|
+
config.add_facet_field Settings.FIELDS.PROVIDER, label: 'Provider', limit: 15
|
141
|
+
|
142
|
+
# Accrual Method
|
143
|
+
# config.add_facet_field Settings.FIELDS.B1G_ACCRUAL_METHOD, :label => 'Accrual Method'
|
144
|
+
|
145
|
+
# Public/Restricted
|
146
|
+
config.add_facet_field Settings.FIELDS.ACCESS_RIGHTS, :label => 'Public/Restricted'
|
147
|
+
|
148
|
+
# ADVANCED SEARCH
|
149
|
+
#
|
150
|
+
# Code
|
151
|
+
# config.add_facet_field Settings.FIELDS.B1G_CODE, label: 'Code', show: false
|
152
|
+
|
153
|
+
# Is Part Of
|
154
|
+
config.add_facet_field Settings.FIELDS.IS_PART_OF, label: 'Is Part Of', show: false
|
155
|
+
|
156
|
+
# Member Of
|
157
|
+
config.add_facet_field Settings.FIELDS.MEMBER_OF, label: 'Member Of', show: false
|
158
|
+
|
159
|
+
# Resource Type
|
160
|
+
config.add_facet_field Settings.FIELDS.RESOURCE_TYPE, label: 'Resource Type', show: false
|
161
|
+
|
162
|
+
# Subject
|
163
|
+
config.add_facet_field Settings.FIELDS.SUBJECT, label: 'Subject', show: false
|
164
|
+
|
165
|
+
# Theme
|
166
|
+
config.add_facet_field Settings.FIELDS.THEME, label: 'Theme', show: false
|
167
|
+
|
168
|
+
# Format
|
169
|
+
config.add_facet_field Settings.FIELDS.FORMAT, label: 'Format', show: false
|
170
|
+
|
171
|
+
# Suppressed
|
172
|
+
config.add_facet_field Settings.FIELDS.SUPPRESSED, label: 'Suppressed', show: false
|
173
|
+
|
174
|
+
# Child Record
|
175
|
+
# config.add_facet_field Settings.FIELDS.B1G_CHILD_RECORD, label: 'Child Record', show: false
|
176
|
+
|
177
|
+
# Georeferenced
|
178
|
+
config.add_facet_field Settings.FIELDS.GEOREFERENCED, label: 'Georeferenced', show: false
|
179
|
+
|
180
|
+
# Have BL send all facet field names to Solr, which has been the default
|
181
|
+
# previously. Simply remove these lines if you'd rather use Solr request
|
182
|
+
# handler defaults, or have no facets.
|
183
|
+
config.add_facet_fields_to_solr_request!
|
184
|
+
|
185
|
+
# solr fields to be displayed in the index (search results) view
|
186
|
+
# The ordering of the field names is the order of the display
|
187
|
+
# config.add_index_field 'title_display', :label => 'Title:'
|
188
|
+
# config.add_index_field 'title_vern_display', :label => 'Title:'
|
189
|
+
# config.add_index_field 'author_display', :label => 'Author:'
|
190
|
+
# config.add_index_field 'author_vern_display', :label => 'Author:'
|
191
|
+
# config.add_index_field 'format', :label => 'Format:'
|
192
|
+
# config.add_index_field 'language_facet', :label => 'Language:'
|
193
|
+
# config.add_index_field 'published_display', :label => 'Published:'
|
194
|
+
# config.add_index_field 'published_vern_display', :label => 'Published:'
|
195
|
+
# config.add_index_field 'lc_callnum_display', :label => 'Call number:'
|
196
|
+
|
197
|
+
config.add_index_field Settings.FIELDS.TITLE, :label => 'Title:'
|
198
|
+
# config.add_index_field Settings.FIELDS.B1G_GEOMG_ID, :label => 'Identifier:'
|
199
|
+
config.add_index_field Settings.FIELDS.PROVIDER, :label => 'Institution:'
|
200
|
+
config.add_index_field Settings.FIELDS.ACCESS_RIGHTS, :label => 'Access:'
|
201
|
+
config.add_index_field Settings.FIELDS.SUBJECT, :label => 'Keywords:'
|
202
|
+
config.add_index_field Settings.FIELDS.CENTROID, :label => 'Centroid:'
|
203
|
+
config.add_index_field Settings.FIELDS.INDEX_YEAR
|
204
|
+
config.add_index_field Settings.FIELDS.CREATOR
|
205
|
+
config.add_index_field Settings.FIELDS.DESCRIPTION, helper_method: :snippit
|
206
|
+
config.add_index_field Settings.FIELDS.PUBLISHER
|
207
|
+
config.add_index_field Settings.FIELDS.SUPPRESSED, :label => 'Suppressed:'
|
208
|
+
|
209
|
+
# solr fields to be displayed in the show (single result) view
|
210
|
+
# The ordering of the field names is the order of the display
|
211
|
+
#
|
212
|
+
# item_prop: [String] property given to span with Schema.org item property
|
213
|
+
# link_to_facet: [Boolean] that can be passed to link to a facet search
|
214
|
+
# helper_method: [Symbol] method that can be used to render the value
|
215
|
+
config.add_show_field Settings.FIELDS.CREATOR, label: 'Creator', itemprop: 'creator'
|
216
|
+
config.add_show_field Settings.FIELDS.DESCRIPTION, label: 'Description', itemprop: 'description', helper_method: :render_value_as_truncate_abstract
|
217
|
+
config.add_show_field Settings.FIELDS.PUBLISHER, label: 'Publisher', itemprop: 'publisher', link_to_facet: true
|
218
|
+
config.add_show_field Settings.FIELDS.SPATIAL_COVERAGE, label: 'Place', itemprop: 'spatial', link_to_facet: true, helper_method: :render_placenames_as_truncate_abstract
|
219
|
+
config.add_show_field Settings.FIELDS.SUBJECT, label: 'Subject', itemprop: 'keywords', link_to_facet: true
|
220
|
+
config.add_show_field Settings.FIELDS.RESOURCE_TYPE, label: 'Type', itemprop: 'keywords', link_to_facet: true
|
221
|
+
config.add_show_field Settings.FIELDS.DATE_ISSUED, label: 'Date Published', itemprop: 'keywords', link_to_facet: true
|
222
|
+
config.add_show_field Settings.FIELDS.TEMPORAL_COVERAGE, label: 'Temporal Coverage', itemprop: 'temporal'
|
223
|
+
config.add_show_field Settings.FIELDS.PROVIDER, label: 'Contributed by', link_to_facet: true
|
224
|
+
config.add_show_field Settings.FIELDS.RIGHTS, label: 'Access Rights'
|
225
|
+
|
226
|
+
# "fielded" search configuration. Used by pulldown among other places.
|
227
|
+
# For supported keys in hash, see rdoc for Blacklight::SearchFields
|
228
|
+
#
|
229
|
+
# Search fields will inherit the :qt solr request handler from
|
230
|
+
# config[:default_solr_parameters], OR can specify a different one
|
231
|
+
# with a :qt key/value. Below examples inherit, except for subject
|
232
|
+
# that specifies the same :qt as default for our own internal
|
233
|
+
# testing purposes.
|
234
|
+
#
|
235
|
+
# The :key is what will be used to identify this BL search field internally,
|
236
|
+
# as well as in URLs -- so changing it after deployment may break bookmarked
|
237
|
+
# urls. A display label will be automatically calculated from the :key,
|
238
|
+
# or can be specified manually to be different.
|
239
|
+
|
240
|
+
# This one uses all the defaults set by the solr request handler. Which
|
241
|
+
# solr request handler? The one set in config[:default_solr_parameters][:qt],
|
242
|
+
# since we aren't specifying it otherwise.
|
243
|
+
|
244
|
+
config.add_search_field('all_fields') do |field|
|
245
|
+
field.include_in_advanced_search = false
|
246
|
+
field.label = 'All Fields'
|
247
|
+
end
|
248
|
+
|
249
|
+
config.add_search_field('keyword') do |field|
|
250
|
+
field.include_in_simple_select = false
|
251
|
+
field.qt = 'search'
|
252
|
+
field.label = 'Keyword'
|
253
|
+
field.solr_local_parameters = {
|
254
|
+
qf: '$qf',
|
255
|
+
pf: '$pf'
|
256
|
+
}
|
257
|
+
end
|
258
|
+
|
259
|
+
config.add_search_field('title') do |field|
|
260
|
+
field.include_in_simple_select = false
|
261
|
+
field.qt = 'search'
|
262
|
+
field.label = 'Title'
|
263
|
+
field.solr_local_parameters = {
|
264
|
+
qf: '$title_qf',
|
265
|
+
pf: '$title_pf'
|
266
|
+
}
|
267
|
+
end
|
268
|
+
|
269
|
+
config.add_search_field('placename') do |field|
|
270
|
+
field.include_in_simple_select = false
|
271
|
+
field.qt = 'search'
|
272
|
+
field.label = 'Place'
|
273
|
+
field.solr_local_parameters = {
|
274
|
+
qf: '$placename_qf',
|
275
|
+
pf: '$placename_pf'
|
276
|
+
}
|
277
|
+
end
|
278
|
+
|
279
|
+
config.add_search_field('publisher') do |field|
|
280
|
+
field.include_in_simple_select = false
|
281
|
+
field.qt = 'search'
|
282
|
+
field.label = 'Publisher/Creator'
|
283
|
+
field.solr_local_parameters = {
|
284
|
+
qf: '$publisher_qf',
|
285
|
+
pf: '$publisher_pf'
|
286
|
+
}
|
287
|
+
end
|
288
|
+
|
289
|
+
# "sort results by" select (pulldown)
|
290
|
+
# label in pulldown is followed by the name of the SOLR field to sort by and
|
291
|
+
# whether the sort is ascending or descending (it must be asc or desc
|
292
|
+
# except in the relevancy case).
|
293
|
+
config.add_sort_field 'score desc, dct_title_sort asc', :label => 'Relevance'
|
294
|
+
config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} desc, dct_title_sort asc", :label => 'Year (Newest first)'
|
295
|
+
config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} asc, dct_title_sort asc", :label => 'Year (Oldest first)'
|
296
|
+
config.add_sort_field 'dct_title_sort asc', :label => 'Title (A-Z)'
|
297
|
+
config.add_sort_field 'dct_title_sort desc', :label => 'Title (Z-A)'
|
298
|
+
config.add_sort_field 'date_modified_dtsi desc', :label => 'Updated At (Newest first)'
|
299
|
+
config.add_sort_field 'date_modified_dtsi asc', :label => 'Updated At (Oldest first)'
|
300
|
+
|
301
|
+
# If there are more than this many search results, no spelling ("did you
|
302
|
+
# mean") suggestion is offered.
|
303
|
+
config.spell_max = 5
|
304
|
+
|
305
|
+
# Custom tools for GeoBlacklight
|
306
|
+
config.add_show_tools_partial :more_details, partial: 'more_details', if: proc { |_context, _config, options| options[:document] && (!options[:document].references.nil? & !options[:document].references.url.nil?)}
|
307
|
+
config.add_show_tools_partial :metadata, if: proc { |_context, _config, options| options[:document] && (Settings.METADATA_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? }
|
308
|
+
config.add_show_tools_partial :web_services, if: proc { |_context, _config, options| options[:document] && (Settings.WEBSERVICES_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? }
|
309
|
+
config.add_show_tools_partial :exports, partial: 'exports', if: proc { |_context, _config, options| options[:document] }
|
310
|
+
config.add_show_tools_partial :data_dictionary, partial: 'data_dictionary', if: proc { |_context, _config, options| options[:document] && options[:document].data_dictionary_download.present?}
|
311
|
+
config.add_show_tools_partial(:citation)
|
312
|
+
config.add_show_tools_partial(:access_links, partial: 'access_links', if: proc { |_context, _config, options| options[:document] && options[:document].access_links.present?})
|
313
|
+
|
314
|
+
# Remove nav actions
|
315
|
+
config.add_nav_action(:bookmark, partial: 'blacklight/nav/bookmark', if: false)
|
316
|
+
|
317
|
+
# Remove show tools
|
318
|
+
config.show.partials.delete(:show_header)
|
319
|
+
config.show.partials.delete(:show)
|
320
|
+
|
321
|
+
config.show.display_type_field = 'format'
|
322
|
+
config.show.partials << 'show_header'
|
323
|
+
config.show.partials << 'show_default_viewer_container'
|
324
|
+
config.show.partials << 'show_default_viewer_information'
|
325
|
+
config.show.partials << 'show_default_attribute_table'
|
326
|
+
config.show.partials << 'show'
|
327
|
+
|
328
|
+
|
329
|
+
config.show.document_actions.delete(:email)
|
330
|
+
config.show.document_actions.delete(:bookmark)
|
331
|
+
config.show.document_actions.delete(:sms)
|
332
|
+
|
333
|
+
# Configure basemap provider for GeoBlacklight maps (uses https only basemap
|
334
|
+
# providers with open licenses)
|
335
|
+
# Valid basemaps include:
|
336
|
+
# 'mapquest' http://developer.mapquest.com/web/products/open/map
|
337
|
+
# 'positron' http://cartodb.com/basemaps/
|
338
|
+
# 'darkMatter' http://cartodb.com/basemaps/
|
339
|
+
config.basemap_provider = 'esri'
|
340
|
+
config.max_per_page = 100000
|
341
|
+
|
342
|
+
# Configuration for autocomplete suggestor
|
343
|
+
config.autocomplete_enabled = true
|
344
|
+
config.autocomplete_path = 'suggest'
|
345
|
+
end
|
346
|
+
|
347
|
+
# Administrative view of document
|
348
|
+
# - Sidecar Image
|
349
|
+
# - URIs
|
350
|
+
def admin
|
351
|
+
deprecated_response, @document = search_service.fetch(params[:id])
|
352
|
+
end
|
353
|
+
|
354
|
+
# Administrative view for array of document ids
|
355
|
+
# - bookmarks
|
356
|
+
def fetch
|
357
|
+
@response, deprecated_document_list = search_service.fetch(params[:id])
|
358
|
+
|
359
|
+
respond_to do |format|
|
360
|
+
format.json do
|
361
|
+
@presenter = Blacklight::JsonPresenter.new(@response,
|
362
|
+
blacklight_config)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# Administrative view of adv search facets
|
368
|
+
def advanced_search_facets
|
369
|
+
# We want to find the facets available for the current search, but:
|
370
|
+
# * IGNORING current query (add in facets_for_advanced_search_form filter)
|
371
|
+
# * IGNORING current advanced search facets (remove add_advanced_search_to_solr filter)
|
372
|
+
@response, _ = search_service.search_results do |search_builder|
|
373
|
+
search_builder.except(:add_advanced_search_to_solr).append(:facets_for_advanced_search_form)
|
374
|
+
end
|
375
|
+
|
376
|
+
@response
|
377
|
+
|
378
|
+
respond_to do |format|
|
379
|
+
format.json do
|
380
|
+
@presenter = Blacklight::JsonPresenter.new(@response,
|
381
|
+
blacklight_config)
|
382
|
+
end
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Admin::BookmarksController
|
4
|
+
module Admin
|
5
|
+
class BookmarksController < Admin::AdminController
|
6
|
+
before_action :set_document,
|
7
|
+
only: %i[create destroy]
|
8
|
+
|
9
|
+
# GET /bookmarks
|
10
|
+
# GET /bookmarks.json
|
11
|
+
def index
|
12
|
+
@pagy, @bookmarks = pagy(current_user.bookmarks)
|
13
|
+
|
14
|
+
respond_to do |format|
|
15
|
+
format.html { render :index }
|
16
|
+
# B1G CSV
|
17
|
+
format.csv { send_data collect_csv(current_user.bookmarks), filename: "documents-#{Time.zone.today}.csv" }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# POST /bookmarks
|
22
|
+
# POST /bookmarks.json
|
23
|
+
def create
|
24
|
+
@bookmark = Bookmark.find_or_create_by(user: current_user, document: @document)
|
25
|
+
|
26
|
+
respond_to do |format|
|
27
|
+
if @bookmark.save
|
28
|
+
format.html { redirect_to @bookmark, notice: "Bookmark was successfully created." }
|
29
|
+
format.js
|
30
|
+
else
|
31
|
+
format.html { render :new }
|
32
|
+
format.json { render json: @bookmark.errors, status: :unprocessable_entity }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# DELETE /bookmarks/1
|
38
|
+
# DELETE /bookmarks/1.json
|
39
|
+
def destroy
|
40
|
+
Bookmark.destroy_by(user: current_user, document: @document)
|
41
|
+
|
42
|
+
respond_to do |format|
|
43
|
+
format.html { redirect_to bookmarks_url, notice: "Bookmark was successfully destroyed." }
|
44
|
+
format.js
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def set_document
|
51
|
+
@document = Document.find_by(friendlier_id: params["document"])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Only allow a list of trusted parameters through.
|
55
|
+
def bookmark_params
|
56
|
+
params.fetch(:bookmark, {})
|
57
|
+
end
|
58
|
+
|
59
|
+
def collect_csv(bookmarks)
|
60
|
+
CSV.generate(headers: true) do |csv|
|
61
|
+
csv << GeoblacklightAdmin::Schema.instance.importable_fields.map { |k, _v| k.to_s }
|
62
|
+
bookmarks.map do |bookmark|
|
63
|
+
csv << bookmark.document.to_csv
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Admin::BulkActionsController
|
4
|
+
module Admin
|
5
|
+
class BulkActionsController < Admin::AdminController
|
6
|
+
before_action :set_bulk_action, only: %i[show edit update destroy run revert]
|
7
|
+
|
8
|
+
# GET /bulk_actions
|
9
|
+
# GET /bulk_actions.json
|
10
|
+
def index
|
11
|
+
@pagy, @bulk_actions = pagy(BulkAction.all.order(created_at: :desc), items: 20)
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /bulk_actions/1
|
15
|
+
# GET /bulk_actions/1.json
|
16
|
+
def show
|
17
|
+
@pagy, @documents = pagy(@bulk_action.documents, items: 30)
|
18
|
+
@bulk_action.check_run_state
|
19
|
+
end
|
20
|
+
|
21
|
+
# GET /bulk_actions/new
|
22
|
+
def new
|
23
|
+
@bulk_action = BulkAction.new(scope: params[:scope])
|
24
|
+
end
|
25
|
+
|
26
|
+
# GET /bulk_actions/1/edit
|
27
|
+
def edit
|
28
|
+
end
|
29
|
+
|
30
|
+
# POST /bulk_actions
|
31
|
+
# POST /bulk_actions.json
|
32
|
+
def create
|
33
|
+
@bulk_action = BulkAction.new(bulk_action_params)
|
34
|
+
|
35
|
+
respond_to do |format|
|
36
|
+
if @bulk_action.save
|
37
|
+
format.html { redirect_to admin_bulk_action_path(@bulk_action), notice: "Bulk action was successfully created." }
|
38
|
+
format.json { render :show, status: :created, location: @bulk_action }
|
39
|
+
else
|
40
|
+
format.html { render :new }
|
41
|
+
format.json { render json: @bulk_action.errors, status: :unprocessable_entity }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# PATCH/PUT /bulk_actions/1
|
47
|
+
# PATCH/PUT /bulk_actions/1.json
|
48
|
+
def update
|
49
|
+
respond_to do |format|
|
50
|
+
if @bulk_action.update(bulk_action_params)
|
51
|
+
format.html { redirect_to admin_bulk_action_path(@bulk_action), notice: "Bulk action was successfully updated." }
|
52
|
+
format.json { render :show, status: :ok, location: @bulk_action }
|
53
|
+
else
|
54
|
+
format.html { render :edit }
|
55
|
+
format.json { render json: @bulk_action.errors, status: :unprocessable_entity }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# DELETE /bulk_actions/1
|
61
|
+
# DELETE /bulk_actions/1.json
|
62
|
+
def destroy
|
63
|
+
@bulk_action.destroy
|
64
|
+
respond_to do |format|
|
65
|
+
format.html { redirect_to admin_bulk_actions_url, notice: "Bulk action was successfully destroyed." }
|
66
|
+
format.json { head :no_content }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def run
|
71
|
+
@bulk_action.run!
|
72
|
+
@bulk_action.state_machine.transition_to!(:queued)
|
73
|
+
redirect_to admin_bulk_action_url(@bulk_action), notice: "Bulk action is running. Check back soon for results."
|
74
|
+
end
|
75
|
+
|
76
|
+
def revert
|
77
|
+
@bulk_action.revert!
|
78
|
+
@bulk_action.state_machine.transition_to!(:queued)
|
79
|
+
redirect_to admin_bulk_action_url(@bulk_action), notice: "Revert bulk action is running. Check back soon for results."
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
# Use callbacks to share common setup or constraints between actions.
|
85
|
+
def set_bulk_action
|
86
|
+
@bulk_action = BulkAction.find(params[:id])
|
87
|
+
end
|
88
|
+
|
89
|
+
# Only allow a list of trusted parameters through.
|
90
|
+
def bulk_action_params
|
91
|
+
params.fetch(:bulk_action, {})
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
File without changes
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Admin::DocumentAccessesController
|
4
|
+
module Admin
|
5
|
+
class DocumentAccessesController < Admin::AdminController
|
6
|
+
before_action :set_document
|
7
|
+
before_action :set_document_access, only: %i[show edit update destroy]
|
8
|
+
|
9
|
+
# GET /documents/#id/access
|
10
|
+
# GET /documents/#id/access.json
|
11
|
+
def index
|
12
|
+
if params[:document_id]
|
13
|
+
@document_accesses = DocumentAccess.where(friendlier_id: @document.friendlier_id).order(institution_code: :asc)
|
14
|
+
else
|
15
|
+
@pagy, @document_accesses = pagy(DocumentAccess.all.order(friendlier_id: :asc, updated_at: :desc), items: 20)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# GET /document_accesses/1
|
20
|
+
# GET /document_accesses/1.json
|
21
|
+
def show
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /document_accesses/new
|
25
|
+
def new
|
26
|
+
@document_access = DocumentAccess.new
|
27
|
+
end
|
28
|
+
|
29
|
+
# GET /document_accesses/1/edit
|
30
|
+
def edit
|
31
|
+
end
|
32
|
+
|
33
|
+
# POST /document_accesses
|
34
|
+
# POST /document_accesses.json
|
35
|
+
def create
|
36
|
+
@document_access = DocumentAccess.new(document_access_params)
|
37
|
+
logger.debug("DA Params: #{DocumentAccess.new(document_access_params).inspect}")
|
38
|
+
logger.debug("Document ACCESS: #{@document_access.inspect}")
|
39
|
+
|
40
|
+
respond_to do |format|
|
41
|
+
if @document_access.save
|
42
|
+
format.html { redirect_to document_document_accesses_path(@document), notice: "Document access was successfully created." }
|
43
|
+
format.json { render :show, status: :created, location: @document_access }
|
44
|
+
else
|
45
|
+
format.html { render :new }
|
46
|
+
format.json { render json: @document_access.errors, status: :unprocessable_entity }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# PATCH/PUT /document_accesses/1
|
52
|
+
# PATCH/PUT /document_accesses/1.json
|
53
|
+
def update
|
54
|
+
respond_to do |format|
|
55
|
+
if @document_access.update(document_access_params)
|
56
|
+
format.html { redirect_to document_document_accesses_path(@document), notice: "Document access was successfully updated." }
|
57
|
+
format.json { render :show, status: :ok, location: @document_access }
|
58
|
+
else
|
59
|
+
format.html { render :edit }
|
60
|
+
format.json { render json: @document_access.errors, status: :unprocessable_entity }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# DELETE /document_accesses/1
|
66
|
+
# DELETE /document_accesses/1.json
|
67
|
+
def destroy
|
68
|
+
@document_access.destroy
|
69
|
+
respond_to do |format|
|
70
|
+
format.html { redirect_to document_document_accesses_path(@document), notice: "Document access was successfully destroyed." }
|
71
|
+
format.json { head :no_content }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def destroy_all
|
76
|
+
logger.debug("Destroy Access Links")
|
77
|
+
return unless params.dig(:document_access, :assets, :file)
|
78
|
+
|
79
|
+
respond_to do |format|
|
80
|
+
if DocumentAccess.destroy_all(params.dig(:document_access, :assets, :file))
|
81
|
+
format.html { redirect_to document_accesses_path, notice: "Document Access Links were created destroyed." }
|
82
|
+
else
|
83
|
+
format.html { redirect_to document_accesses_path, notice: "Document Access Links could not be destroyed." }
|
84
|
+
end
|
85
|
+
rescue => e
|
86
|
+
format.html { redirect_to document_accesses_path, notice: "Document Access Links could not be destroyed. #{e}" }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# GET /documents/#id/access/import
|
91
|
+
# POST /documents/#id/access/import
|
92
|
+
def import
|
93
|
+
logger.debug("Import Action")
|
94
|
+
return unless params.dig(:document_access, :assets, :file)
|
95
|
+
|
96
|
+
respond_to do |format|
|
97
|
+
if DocumentAccess.import(params.dig(:document_access, :assets, :file))
|
98
|
+
format.html { redirect_to document_accesses_path, notice: "Document access links were created successfully." }
|
99
|
+
else
|
100
|
+
format.html { redirect_to document_accesses_path, notice: "Access URLs could not be created." }
|
101
|
+
end
|
102
|
+
rescue => e
|
103
|
+
format.html { redirect_to document_accesses_path, notice: "Access URLs could not be created. #{e}" }
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
# Use callbacks to share common setup or constraints between actions.
|
110
|
+
def set_document
|
111
|
+
return unless params[:document_id] # If not nested
|
112
|
+
|
113
|
+
@document = Document.includes(:leaf_representative).find_by!(friendlier_id: params[:document_id])
|
114
|
+
end
|
115
|
+
|
116
|
+
def set_document_access
|
117
|
+
@document_access = DocumentAccess.find(params[:id])
|
118
|
+
end
|
119
|
+
|
120
|
+
# Only allow a list of trusted parameters through.
|
121
|
+
def document_access_params
|
122
|
+
params.require(:document_access).permit(:friendlier_id, :institution_code, :access_url)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|