blacklight-spotlight 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -8
- data/Rakefile +40 -39
- data/app/assets/javascripts/spotlight/blacklight_configuration.js +16 -0
- data/app/assets/javascripts/spotlight/blocks/resources_block.js +3 -1
- data/app/assets/stylesheets/spotlight/_blacklight_configuration.scss +2 -2
- data/app/assets/stylesheets/spotlight/_blacklight_overrides.scss +24 -0
- data/app/assets/stylesheets/spotlight/_header.scss +150 -47
- data/app/assets/stylesheets/spotlight/_pages.scss +62 -11
- data/app/assets/stylesheets/spotlight/_report_a_problem.scss +1 -0
- data/app/assets/stylesheets/spotlight/_spotlight.scss +1 -0
- data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +28 -21
- data/app/controllers/spotlight/about_pages_controller.rb +25 -14
- data/app/controllers/spotlight/appearances_controller.rb +34 -30
- data/app/controllers/spotlight/application_controller.rb +2 -1
- data/app/controllers/spotlight/attachments_controller.rb +9 -7
- data/app/controllers/spotlight/browse_controller.rb +13 -9
- data/app/controllers/spotlight/catalog_controller.rb +179 -161
- data/app/controllers/spotlight/concerns/application_controller.rb +22 -20
- data/app/controllers/spotlight/concerns/catalog_search_context.rb +44 -0
- data/app/controllers/spotlight/confirmations_controller.rb +5 -2
- data/app/controllers/spotlight/contact_forms_controller.rb +13 -7
- data/app/controllers/spotlight/contacts_controller.rb +13 -4
- data/app/controllers/spotlight/custom_fields_controller.rb +48 -40
- data/app/controllers/spotlight/dashboards_controller.rb +17 -8
- data/app/controllers/spotlight/default_controller.rb +3 -1
- data/app/controllers/spotlight/exhibits_controller.rb +69 -62
- data/app/controllers/spotlight/feature_pages_controller.rb +21 -11
- data/app/controllers/spotlight/home_pages_controller.rb +6 -5
- data/app/controllers/spotlight/lock_controller.rb +3 -1
- data/app/controllers/spotlight/metadata_configurations_controller.rb +49 -0
- data/app/controllers/spotlight/pages_controller.rb +28 -18
- data/app/controllers/spotlight/resources/upload_controller.rb +53 -46
- data/app/controllers/spotlight/resources_controller.rb +9 -5
- data/app/controllers/spotlight/roles_controller.rb +26 -22
- data/app/controllers/spotlight/search_configurations_controller.rb +66 -0
- data/app/controllers/spotlight/searches_controller.rb +91 -82
- data/app/controllers/spotlight/solr_controller.rb +20 -13
- data/app/controllers/spotlight/tags_controller.rb +5 -3
- data/app/controllers/spotlight/versions_controller.rb +15 -12
- data/app/controllers/spotlight/view_configurations_controller.rb +17 -0
- data/app/helpers/spotlight/application_helper.rb +44 -32
- data/app/helpers/spotlight/browse_helper.rb +13 -1
- data/app/helpers/spotlight/crud_link_helpers.rb +22 -14
- data/app/helpers/spotlight/jcrop_helper.rb +4 -2
- data/app/helpers/spotlight/main_app_helpers.rb +45 -41
- data/app/helpers/spotlight/navbar_helper.rb +6 -0
- data/app/helpers/spotlight/pages_helper.rb +23 -15
- data/app/helpers/spotlight/roles_helper.rb +10 -4
- data/app/helpers/spotlight/search_configurations_helper.rb +22 -0
- data/app/helpers/spotlight/title_helper.rb +16 -13
- data/app/jobs/spotlight/add_uploads_from_csv.rb +13 -9
- data/app/jobs/spotlight/reindex_job.rb +9 -9
- data/app/jobs/spotlight/rename_sidecar_field_job.rb +3 -0
- data/app/mailers/spotlight/confirmation_mailer.rb +2 -0
- data/app/mailers/spotlight/indexing_complete_mailer.rb +4 -2
- data/app/models/ability.rb +3 -0
- data/app/models/concerns/spotlight/ar_light.rb +49 -25
- data/app/models/concerns/spotlight/blacklight_configuration_defaults.rb +25 -10
- data/app/models/concerns/spotlight/exhibit_analytics.rb +28 -0
- data/app/models/concerns/spotlight/image_derivatives.rb +25 -26
- data/app/models/concerns/spotlight/resources/open_graph.rb +23 -19
- data/app/models/concerns/spotlight/resources/web.rb +25 -24
- data/app/models/concerns/spotlight/solr_document.rb +40 -34
- data/app/models/concerns/spotlight/solr_document/active_model_concern.rb +29 -40
- data/app/models/concerns/spotlight/solr_document/atomic_updates.rb +22 -18
- data/app/models/concerns/spotlight/solr_document/finder.rb +23 -18
- data/app/models/concerns/spotlight/solr_document/spotlight_images.rb +43 -39
- data/app/models/concerns/spotlight/solr_document/uploaded_resource.rb +41 -29
- data/app/models/concerns/spotlight/user.rb +25 -19
- data/app/models/sir_trevor_rails/blocks/browse_block.rb +36 -30
- data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +24 -18
- data/app/models/sir_trevor_rails/blocks/oembed_block.rb +8 -4
- data/app/models/sir_trevor_rails/blocks/search_results_block.rb +29 -23
- data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +43 -42
- data/app/models/sir_trevor_rails/blocks/solr_documents_carousel_block.rb +16 -12
- data/app/models/sir_trevor_rails/blocks/solr_documents_embed_block.rb +7 -3
- data/app/models/sir_trevor_rails/blocks/solr_documents_features_block.rb +7 -3
- data/app/models/sir_trevor_rails/blocks/solr_documents_grid_block.rb +7 -3
- data/app/models/sir_trevor_rails/blocks/textable.rb +18 -18
- data/app/models/spotlight/ability.rb +32 -33
- data/app/models/spotlight/about_page.rb +3 -1
- data/app/models/spotlight/analytics/ga.rb +46 -27
- data/app/models/spotlight/attachment.rb +3 -1
- data/app/models/spotlight/blacklight_configuration.rb +146 -68
- data/app/models/spotlight/contact.rb +35 -30
- data/app/models/spotlight/contact_email.rb +6 -3
- data/app/models/spotlight/contact_form.rb +4 -3
- data/app/models/spotlight/custom_field.rb +41 -33
- data/app/models/spotlight/exhibit.rb +104 -130
- data/app/models/spotlight/feature_page.rb +9 -7
- data/app/models/spotlight/featured_image.rb +10 -10
- data/app/models/spotlight/field_metadata.rb +46 -0
- data/app/models/spotlight/home_page.rb +8 -5
- data/app/models/spotlight/lock.rb +4 -3
- data/app/models/spotlight/main_navigation.rb +9 -3
- data/app/models/spotlight/masthead.rb +17 -16
- data/app/models/spotlight/page.rb +16 -16
- data/app/models/spotlight/resource.rb +69 -22
- data/app/models/spotlight/resources/csv_upload.rb +8 -4
- data/app/models/spotlight/resources/upload.rb +68 -57
- data/app/models/spotlight/role.rb +30 -34
- data/app/models/spotlight/search.rb +74 -63
- data/app/models/spotlight/solr_document_sidecar.rb +17 -15
- data/app/serializers/spotlight/exhibit_export_serializer.rb +65 -29
- data/app/serializers/spotlight/page_representer.rb +10 -6
- data/app/uploaders/spotlight/attachment_uploader.rb +4 -6
- data/app/uploaders/spotlight/avatar_uploader.rb +4 -3
- data/app/uploaders/spotlight/featured_image_uploader.rb +15 -14
- data/app/uploaders/spotlight/item_uploader.rb +3 -1
- data/app/uploaders/spotlight/masthead_uploader.rb +4 -2
- data/app/views/catalog/_search_form.html.erb +24 -0
- data/app/views/shared/_browse_navbar.html.erb +1 -1
- data/app/views/shared/_exhibit_navbar.html.erb +1 -1
- data/app/views/spotlight/appearances/edit.html.erb +13 -45
- data/app/views/spotlight/catalog/_edit_default.html.erb +1 -1
- data/app/views/spotlight/custom_fields/_form.html.erb +1 -1
- data/app/views/spotlight/exhibits/edit.html.erb +4 -4
- data/app/views/spotlight/home_pages/_empty.html.erb +1 -3
- data/app/views/spotlight/home_pages/_page_options.html.erb +1 -1
- data/app/views/spotlight/{blacklight_configurations → metadata_configurations}/_metadata_field.html.erb +0 -0
- data/app/views/spotlight/{blacklight_configurations/edit_metadata_fields.html.erb → metadata_configurations/edit.html.erb} +1 -1
- data/app/views/spotlight/pages/show.html.erb +2 -2
- data/app/views/spotlight/search_configurations/_default_per_page.html.erb +5 -0
- data/app/views/spotlight/search_configurations/_document_index_view_types.html.erb +7 -0
- data/app/views/spotlight/search_configurations/_facets.html.erb +38 -0
- data/app/views/spotlight/search_configurations/_search_fields.html.erb +58 -0
- data/app/views/spotlight/search_configurations/_sort.html.erb +53 -0
- data/app/views/spotlight/search_configurations/edit.html.erb +46 -0
- data/app/views/spotlight/searches/_search.html.erb +1 -1
- data/app/views/spotlight/shared/_admin_sidebar.html.erb +0 -2
- data/app/views/spotlight/shared/_curation_sidebar.html.erb +2 -3
- data/app/views/spotlight/shared/_report_a_problem.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_oembed_block.html.erb +5 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +7 -5
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb +7 -5
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +14 -9
- data/config/locales/spotlight.en.yml +94 -49
- data/config/routes.rb +11 -20
- data/db/migrate/20150410180014_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
- data/db/migrate/20150410180015_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
- data/db/migrate/20150410180016_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +10 -0
- data/db/migrate/20150713160101_change_spotlight_searches_to_published.rb +5 -0
- data/db/migrate/20151016092343_remove_searchable_from_exhibit.rb +20 -0
- data/lib/blacklight/spotlight.rb +1 -1
- data/lib/generators/spotlight/install_generator.rb +27 -25
- data/lib/generators/spotlight/templates/catalog_controller.rb +7 -5
- data/lib/generators/spotlight/templates/jetty.rake +8 -2
- data/lib/generators/spotlight/templates/spotlight_helper.rb +3 -1
- data/lib/spotlight.rb +4 -2
- data/lib/spotlight/base.rb +21 -14
- data/lib/spotlight/catalog.rb +10 -9
- data/lib/spotlight/catalog/access_controls_enforcement.rb +30 -15
- data/lib/spotlight/config.rb +4 -2
- data/lib/spotlight/controller.rb +12 -11
- data/lib/spotlight/engine.rb +30 -22
- data/lib/spotlight/rails/routes.rb +7 -4
- data/lib/spotlight/version.rb +2 -1
- data/lib/tasks/spotlight_tasks.rake +56 -50
- data/spec/controllers/application_controller_spec.rb +13 -13
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +63 -59
- data/spec/controllers/spotlight/appearances_controller_spec.rb +29 -24
- data/spec/controllers/spotlight/application_controller_spec.rb +3 -3
- data/spec/controllers/spotlight/attachments_controller_spec.rb +10 -10
- data/spec/controllers/spotlight/browse_controller_spec.rb +23 -25
- data/spec/controllers/spotlight/catalog_controller_spec.rb +82 -87
- data/spec/controllers/spotlight/confirmations_controller_spec.rb +13 -11
- data/spec/controllers/spotlight/contact_forms_controller_spec.rb +17 -12
- data/spec/controllers/spotlight/contacts_controller_spec.rb +36 -36
- data/spec/controllers/spotlight/custom_fields_controller_spec.rb +26 -26
- data/spec/controllers/spotlight/dashboards_controller_spec.rb +14 -14
- data/spec/controllers/spotlight/exhibits_controller_spec.rb +59 -54
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +59 -59
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +28 -29
- data/spec/controllers/spotlight/metadata_configurations_controller_spec.rb +84 -0
- data/spec/controllers/spotlight/resources/upload_controller_spec.rb +42 -33
- data/spec/controllers/spotlight/resources_controller_spec.rb +25 -29
- data/spec/controllers/spotlight/roles_controller_spec.rb +37 -19
- data/spec/controllers/spotlight/search_configurations_controller_spec.rb +125 -0
- data/spec/controllers/spotlight/searches_controller_spec.rb +84 -63
- data/spec/controllers/spotlight/solr_controller_spec.rb +13 -14
- data/spec/controllers/spotlight/tags_controller_spec.rb +16 -16
- data/spec/controllers/spotlight/versions_controller_spec.rb +15 -18
- data/spec/controllers/spotlight/view_configurations_controller_spec.rb +31 -0
- data/spec/factories/contacts.rb +1 -3
- data/spec/factories/custom_fields.rb +2 -4
- data/spec/factories/exhibits.rb +4 -2
- data/spec/factories/pages.rb +8 -11
- data/spec/factories/resources.rb +4 -4
- data/spec/factories/searches.rb +10 -13
- data/spec/factories/tags.rb +0 -3
- data/spec/factories/users.rb +2 -4
- data/spec/features/about_page_spec.rb +19 -19
- data/spec/features/add_contacts_spec.rb +34 -34
- data/spec/features/add_custom_field_metadata_spec.rb +24 -26
- data/spec/features/add_item_bookmarklet_spec.rb +12 -12
- data/spec/features/browse_category_admin_spec.rb +39 -39
- data/spec/features/catalog_spec.rb +9 -10
- data/spec/features/confirm_email_spec.rb +10 -10
- data/spec/features/create_exhibit_spec.rb +18 -15
- data/spec/features/create_page_spec.rb +8 -8
- data/spec/features/curator_items.rb +3 -3
- data/spec/features/dashboard_spec.rb +15 -16
- data/spec/features/edit_contact_spec.rb +8 -10
- data/spec/features/edit_search_fields_spec.rb +79 -0
- data/spec/features/exhibits/add_tags_spec.rb +15 -16
- data/spec/features/exhibits/administration_spec.rb +25 -25
- data/spec/features/exhibits/custom_metadata_fields_spec.rb +41 -43
- data/spec/features/exhibits/edit_metadata_fields_spec.rb +19 -19
- data/spec/features/feature_page_spec.rb +49 -48
- data/spec/features/home_page_spec.rb +38 -38
- data/spec/features/import_exhibit_spec.rb +23 -20
- data/spec/features/item_admin_spec.rb +28 -29
- data/spec/features/javascript/about_page_admin_spec.rb +9 -9
- data/spec/features/javascript/block_controls_spec.rb +16 -18
- data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +11 -12
- data/spec/features/javascript/blocks/featured_pages_block_spec.rb +12 -13
- data/spec/features/javascript/blocks/search_result_block_spec.rb +17 -17
- data/spec/features/javascript/blocks/solr_documents_block_spec.rb +67 -65
- data/spec/features/javascript/edit_in_place_spec.rb +30 -56
- data/spec/features/javascript/feature_page_admin_spec.rb +73 -59
- data/spec/features/javascript/home_page_edit_spec.rb +6 -6
- data/spec/features/javascript/metadata_admin_spec.rb +15 -15
- data/spec/features/javascript/multi_image_select_spec.rb +17 -18
- data/spec/features/javascript/preview_block_spec.rb +11 -12
- data/spec/features/javascript/rule_block_spec.rb +7 -7
- data/spec/features/javascript/search_config_admin_spec.rb +144 -0
- data/spec/features/javascript/search_context_spec.rb +41 -42
- data/spec/features/main_navigation_spec.rb +22 -22
- data/spec/features/metadata_admin_spec.rb +8 -8
- data/spec/features/multiple_exhibits_spec.rb +15 -17
- data/spec/features/report_a_problem_spec.rb +23 -17
- data/spec/features/site_masthead_spec.rb +46 -46
- data/spec/features/slideshow_spec.rb +8 -9
- data/spec/features/tags_admin_spec.rb +11 -11
- data/spec/features/upload_non_repository_item_spec.rb +32 -32
- data/spec/features/user_admin_spec.rb +7 -7
- data/spec/helpers/spotlight/application_helper_spec.rb +63 -56
- data/spec/helpers/spotlight/browse_helper_spec.rb +6 -6
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +58 -52
- data/spec/helpers/spotlight/main_app_helpers_spec.rb +44 -24
- data/spec/helpers/spotlight/navbar_helper_spec.rb +4 -4
- data/spec/helpers/spotlight/pages_helper_spec.rb +56 -37
- data/spec/helpers/spotlight/roles_helper_spec.rb +3 -3
- data/spec/helpers/spotlight/search_configurations_helper_spec.rb +24 -0
- data/spec/helpers/spotlight/title_helper_spec.rb +33 -35
- data/spec/jobs/spotlight/reindex_job_spec.rb +6 -6
- data/spec/jobs/spotlight/rename_sidecar_field_job_spec.rb +7 -7
- data/spec/lib/spotlight/catalog/access_controls_enforcement_spec.rb +41 -26
- data/spec/lib/spotlight/controller_spec.rb +10 -10
- data/spec/lib/spotlight/routes_spec.rb +4 -4
- data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +13 -13
- data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +8 -8
- data/spec/models/{spotlight/sir_trevor_blocks → sir_trevor_rails/blocks}/textable_spec.rb +7 -8
- data/spec/models/solr_document_spec.rb +49 -50
- data/spec/models/spotlight/ability_spec.rb +17 -20
- data/spec/models/spotlight/about_page_spec.rb +6 -6
- data/spec/models/spotlight/analytics/ga_spec.rb +2 -2
- data/spec/models/spotlight/blacklight_configuration_spec.rb +196 -133
- data/spec/models/spotlight/contact_email_spec.rb +28 -24
- data/spec/models/spotlight/contact_spec.rb +6 -7
- data/spec/models/spotlight/custom_field_spec.rb +51 -52
- data/spec/models/spotlight/exhibit_spec.rb +102 -60
- data/spec/models/spotlight/feature_page_spec.rb +32 -32
- data/spec/models/spotlight/featured_image_spec.rb +5 -5
- data/spec/models/spotlight/field_metadata_spec.rb +78 -0
- data/spec/models/spotlight/home_page_spec.rb +11 -20
- data/spec/models/spotlight/{spotlight_image_derivatives_spec.rb → image_derivatives_spec.rb} +2 -2
- data/spec/models/spotlight/main_navigation_spec.rb +7 -9
- data/spec/models/spotlight/masthead_spec.rb +6 -6
- data/spec/models/spotlight/page_spec.rb +26 -29
- data/spec/models/spotlight/resource_spec.rb +56 -26
- data/spec/models/spotlight/resources/open_graph_spec.rb +16 -18
- data/spec/models/spotlight/resources/upload_spec.rb +32 -35
- data/spec/models/spotlight/resources/web_spec.rb +9 -11
- data/spec/models/spotlight/role_spec.rb +20 -20
- data/spec/models/spotlight/search_spec.rb +32 -15
- data/spec/models/spotlight/solr_document/atomic_updates_spec.rb +34 -0
- data/spec/models/spotlight/{solr_document_images_spec.rb → solr_document/spotlight_images_spec.rb} +18 -10
- data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +52 -0
- data/spec/models/spotlight/solr_document_sidecar_spec.rb +3 -4
- data/spec/routing/spotlight/exhibit_catalog_spec.rb +5 -5
- data/spec/routing/spotlight/pages_routing_spec.rb +24 -25
- data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +88 -68
- data/spec/spec_helper.rb +13 -22
- data/spec/support/features/test_features_helpers.rb +50 -46
- data/spec/support/views/test_view_helpers.rb +1 -1
- data/spec/test_app_templates/Gemfile.extra +0 -1
- data/spec/test_app_templates/carrierwave.rb +2 -2
- data/spec/test_app_templates/catalog_controller.rb +42 -42
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +20 -11
- data/spec/test_app_templates/spotlight_test.rake +3 -3
- data/spec/uploaders/spotlight/item_uploader_spec.rb +68 -0
- data/spec/views/_user_util_links.html.erb_spec.rb +14 -14
- data/spec/views/shared/_analytics.html.erb_spec.rb +4 -6
- data/spec/views/shared/_exhibit_masthead.html.erb_spec.rb +19 -20
- data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +129 -131
- data/spec/views/shared/_footer.html.erb_spec.rb +6 -7
- data/spec/views/shared/_header_navbar.html.erb_spec.rb +5 -5
- data/spec/views/spotlight/about_pages/_empty.html.erb_spec.rb +4 -4
- data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +9 -11
- data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +31 -28
- data/spec/views/spotlight/browse/_search.html.erb_spec.rb +6 -6
- data/spec/views/spotlight/browse/_sort_and_per_page.html.erb_spec.rb +10 -12
- data/spec/views/spotlight/browse/index.html.erb_spec.rb +6 -6
- data/spec/views/spotlight/browse/show.html.erb_spec.rb +19 -20
- data/spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb +7 -7
- data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +7 -7
- data/spec/views/spotlight/catalog/edit.html.erb_spec.rb +3 -6
- data/spec/views/spotlight/catalog/new.html.erb_spec.rb +8 -10
- data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +8 -8
- data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +22 -22
- data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +7 -8
- data/spec/views/spotlight/feature_pages/_empty.html.erb_spec.rb +5 -5
- data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +24 -26
- data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +13 -9
- data/spec/views/spotlight/home_pages/_sidebar.html.erb_spec.rb +6 -6
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +26 -0
- data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +22 -0
- data/spec/views/spotlight/pages/edit.html.erb_spec.rb +16 -16
- data/spec/views/spotlight/pages/index.html.erb_spec.rb +19 -17
- data/spec/views/spotlight/pages/new.html.erb_spec.rb +6 -6
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +27 -28
- data/spec/views/spotlight/roles/index.html.erb_spec.rb +6 -6
- data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +54 -0
- data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +28 -0
- data/spec/views/spotlight/searches/_search.html.erb_spec.rb +20 -10
- data/spec/views/spotlight/searches/edit.html.erb_spec.rb +12 -11
- data/spec/views/spotlight/searches/index.html.erb_spec.rb +12 -7
- data/spec/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb_spec.rb +7 -8
- data/spec/views/spotlight/sir_trevor/blocks/_rule_block.html.erb_spec.rb +4 -4
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb +38 -0
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +7 -8
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +18 -13
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +14 -12
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +11 -12
- data/spec/views/spotlight/tags/index.html.erb_spec.rb +9 -9
- metadata +167 -83
- data/app/controllers/spotlight/blacklight_configurations_controller.rb +0 -101
- data/app/controllers/spotlight/resources/csv_controller.rb +0 -23
- data/app/forms/spotlight/appearance.rb +0 -86
- data/app/helpers/spotlight/attachments_helper.rb +0 -4
- data/app/helpers/spotlight/blacklight_configurations_helper.rb +0 -15
- data/app/jobs/spotlight/set_default_thumbnail_job.rb +0 -16
- data/app/models/spotlight/resources/csv.rb +0 -80
- data/app/uploaders/spotlight/csv_uploader.rb +0 -15
- data/app/views/spotlight/blacklight_configurations/edit_facet_fields.html.erb +0 -47
- data/app/views/spotlight/blacklight_configurations/edit_sort_fields.html.erb +0 -65
- data/app/views/spotlight/resources/csv/_form.html.erb +0 -17
- data/app/views/spotlight/resources/csv/new.html.erb +0 -3
- data/spec/controllers/spotlight/blacklight_configurations_controller_spec.rb +0 -167
- data/spec/features/edit_sort_fields_spec.rb +0 -42
- data/spec/features/exhibits/edit_facet_fields_spec.rb +0 -37
- data/spec/features/javascript/facet_admin_spec.rb +0 -36
- data/spec/features/search_facets_admin_spec.rb +0 -19
- data/spec/features/update_appearance_spec.rb +0 -58
- data/spec/helpers/spotlight/blacklight_configurations_helper_spec.rb +0 -12
- data/spec/models/spotlight/appearance_spec.rb +0 -33
- data/spec/models/spotlight/resources/csv_spec.rb +0 -101
- data/spec/models/spotlight/solr_document_atomic_updates_spec.rb +0 -29
- data/spec/models/spotlight/solr_document_uploaded_resource_spec.rb +0 -45
- data/spec/uploaders/item_uploader_spec.rb +0 -62
- data/spec/views/spotlight/blacklight_configuration/_metadata_field.html.erb_spec.rb +0 -27
- data/spec/views/spotlight/blacklight_configuration/edit_metadata_fields.html.erb_spec.rb +0 -23
- data/spec/views/spotlight/blacklight_configuration/edit_sort_fields.html.erb_spec.rb +0 -19
@@ -103,14 +103,23 @@
|
|
103
103
|
}
|
104
104
|
|
105
105
|
.contact-photo {
|
106
|
-
|
107
|
-
|
108
|
-
|
106
|
+
border: 1px solid #ccc;
|
107
|
+
border-radius: $border-radius-base;
|
108
|
+
float: left;
|
109
|
+
margin-right: 15px;
|
110
|
+
margin-top: 3px;
|
111
|
+
}
|
112
|
+
|
113
|
+
// Indent contact fields so they align evenly, only when there is a contact photo
|
114
|
+
.sidenav.contacts .contact-photo + div[itemprop] ~ div[itemprop] {
|
115
|
+
margin-left: 87px;
|
109
116
|
}
|
110
117
|
|
111
118
|
.item-grid-block {
|
112
119
|
h3 {margin-top: 0;}
|
113
120
|
.items-col {
|
121
|
+
margin-bottom: 1em;
|
122
|
+
z-index: 1;
|
114
123
|
display: flex;
|
115
124
|
flex-flow: row wrap;
|
116
125
|
justify-content: space-between;
|
@@ -143,7 +152,11 @@
|
|
143
152
|
min-width: 25%;
|
144
153
|
height: 120px;
|
145
154
|
@media (min-width: $screen-lg-min) {
|
146
|
-
height:
|
155
|
+
height: 170px; // default: no sidebar, no text column
|
156
|
+
// reduce height if on a page with a sidebar or text column, because will be less wide
|
157
|
+
.col-md-9 & {
|
158
|
+
height: 135px;
|
159
|
+
}
|
147
160
|
}
|
148
161
|
padding: 5px;
|
149
162
|
}
|
@@ -159,15 +172,20 @@
|
|
159
172
|
.item-0, .item-1, .item-2 {
|
160
173
|
height: 220px;
|
161
174
|
order: 0;
|
162
|
-
|
163
175
|
@media (min-width: $screen-lg-min) {
|
164
|
-
height:
|
176
|
+
height: 280px; // default: no sidebar, no text column
|
177
|
+
// reduce height if on a page with a sidebar or text column, because will be less wide
|
178
|
+
.col-md-9 & {
|
179
|
+
height: 240px;
|
180
|
+
}
|
165
181
|
}
|
166
182
|
}
|
167
|
-
|
168
183
|
}
|
169
184
|
@media (max-width: $screen-sm-max) {
|
170
|
-
.items-col {margin-bottom: $line-height-computed;}
|
185
|
+
&.items-block .items-col {margin-bottom: $line-height-computed;}
|
186
|
+
}
|
187
|
+
@media (min-width: $screen-md-min) and (max-width: $screen-md-max) {
|
188
|
+
&.items-block .items-col .box {min-width: 128px;}
|
171
189
|
}
|
172
190
|
}
|
173
191
|
|
@@ -205,9 +223,42 @@
|
|
205
223
|
}
|
206
224
|
}
|
207
225
|
|
208
|
-
.items-block
|
209
|
-
|
210
|
-
|
226
|
+
.items-block {
|
227
|
+
|
228
|
+
.text-col {
|
229
|
+
float: none;
|
230
|
+
width: auto;
|
231
|
+
}
|
232
|
+
.items-col {
|
233
|
+
z-index: 1;
|
234
|
+
|
235
|
+
@media (max-width: $screen-sm-max) {
|
236
|
+
margin-bottom: 0;
|
237
|
+
}
|
238
|
+
|
239
|
+
.box {
|
240
|
+
min-width: 150px;
|
241
|
+
}
|
242
|
+
|
243
|
+
/* two items */
|
244
|
+
.box:first-child:nth-last-child(2),
|
245
|
+
.box:first-child:nth-last-child(2) ~ .box {
|
246
|
+
min-width: 250px;
|
247
|
+
}
|
248
|
+
|
249
|
+
/* only images, no text */
|
250
|
+
&:last-child {
|
251
|
+
.box {
|
252
|
+
padding: 0.25em;
|
253
|
+
img {
|
254
|
+
height: 250px;
|
255
|
+
object-fit: cover;
|
256
|
+
@media (max-width: $screen-sm-max) {
|
257
|
+
height: 175px;
|
258
|
+
}
|
259
|
+
}
|
260
|
+
}
|
261
|
+
}
|
211
262
|
}
|
212
263
|
}
|
213
264
|
|
@@ -1,28 +1,35 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
module Spotlight
|
2
|
+
# The BootstrapBreadcrumbsBuilder is a Bootstrap compatible breadcrumb builder.
|
3
|
+
# It provides basic functionalities to render a breadcrumb navigation according to Bootstrap's conventions.
|
4
|
+
#
|
5
|
+
# BootstrapBreadcrumbsBuilder accepts a limited set of options:
|
6
|
+
#
|
7
|
+
# You can use it with the :builder option on render_breadcrumbs:
|
8
|
+
# <%= render_breadcrumbs :builder => Spotlight::BootstrapBreadcrumbsBuilder %>
|
9
|
+
#
|
10
|
+
class BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder
|
11
|
+
include ActionView::Helpers::OutputSafetyHelper
|
12
|
+
|
13
|
+
def render
|
14
|
+
return '' if @elements.blank?
|
15
|
+
|
16
|
+
@context.content_tag(:ul, class: 'breadcrumb') do
|
17
|
+
safe_join(@elements.uniq.map { |e| render_element(e) })
|
18
|
+
end
|
14
19
|
end
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
21
|
+
def render_element(element)
|
22
|
+
html_class = 'active' if @context.current_page?(compute_path(element))
|
23
|
+
|
24
|
+
@context.content_tag(:li, class: html_class) do
|
25
|
+
@context.link_to_unless_current(element_label(element), compute_path(element), element.options)
|
26
|
+
end
|
27
|
+
end
|
20
28
|
|
21
|
-
|
22
|
-
html_class = 'active' if @context.current_page?(compute_path(element))
|
29
|
+
private
|
23
30
|
|
24
|
-
|
25
|
-
@context.
|
31
|
+
def element_label(element)
|
32
|
+
@context.truncate(compute_name(element), length: 30, separator: ' ')
|
26
33
|
end
|
27
34
|
end
|
28
35
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module Spotlight
|
2
|
+
##
|
3
|
+
# CRUD actions for about pages and contacts
|
2
4
|
class AboutPagesController < PagesController
|
3
5
|
load_and_authorize_resource through: :exhibit, instance_name: 'page'
|
4
|
-
|
5
|
-
|
6
|
+
before_action :attach_breadcrumbs, except: [:update_contacts]
|
6
7
|
|
7
8
|
def update_contacts
|
8
9
|
if @exhibit.update(contact_params)
|
@@ -17,32 +18,42 @@ module Spotlight
|
|
17
18
|
def attach_breadcrumbs
|
18
19
|
super
|
19
20
|
if @page
|
20
|
-
|
21
|
-
|
22
|
-
else
|
23
|
-
add_breadcrumb (@exhibit.main_navigations.about.label_or_default), [@exhibit, @exhibit.main_about_page]
|
24
|
-
end
|
25
|
-
|
26
|
-
unless @page == @exhibit.main_about_page
|
27
|
-
add_breadcrumb @page.title, action_name == 'edit' ? [:edit, @page.exhibit, @page] : [@page.exhibit, @page]
|
28
|
-
end
|
21
|
+
attach_section_breadcrumbs
|
22
|
+
attach_page_breadcrumbs
|
29
23
|
elsif action_name == 'index'
|
30
24
|
add_breadcrumb t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)
|
31
25
|
add_breadcrumb t(:'spotlight.pages.index.about_pages.header'), exhibit_about_pages_path(@exhibit)
|
32
26
|
end
|
33
27
|
end
|
34
28
|
|
29
|
+
def attach_page_breadcrumbs
|
30
|
+
return if @page == @exhibit.main_about_page
|
31
|
+
|
32
|
+
if action_name == 'edit'
|
33
|
+
add_breadcrumb @page.title, [:edit, @page.exhibit, @page]
|
34
|
+
else
|
35
|
+
add_breadcrumb @page.title, [@page.exhibit, @page]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def attach_section_breadcrumbs
|
40
|
+
if action_name == 'edit'
|
41
|
+
add_breadcrumb t(:'spotlight.pages.index.about_pages.header'), exhibit_about_pages_path(@exhibit)
|
42
|
+
else
|
43
|
+
add_breadcrumb((@exhibit.main_navigations.about.label_or_default), [@exhibit, @exhibit.main_about_page])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
35
47
|
def contact_params
|
36
|
-
params.require(:exhibit).permit(
|
48
|
+
params.require(:exhibit).permit('contacts_attributes' => [:id, :show_in_sidebar, :weight])
|
37
49
|
end
|
38
50
|
|
39
51
|
def update_all_page_params
|
40
|
-
params.require(:exhibit).permit(
|
52
|
+
params.require(:exhibit).permit('about_pages_attributes' => page_attributes)
|
41
53
|
end
|
42
54
|
|
43
55
|
def allowed_page_params
|
44
56
|
super.concat [:published]
|
45
57
|
end
|
46
|
-
|
47
58
|
end
|
48
59
|
end
|
@@ -1,38 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Spotlight
|
2
|
+
##
|
3
|
+
# Edit and update an exhibit's appearance
|
4
|
+
class AppearancesController < Spotlight::ApplicationController
|
5
|
+
before_action :authenticate_user!
|
6
|
+
load_and_authorize_resource id_param: :exhibit_id, instance_name: 'exhibit', class: 'Spotlight::Exhibit', parent: false
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
def update
|
9
|
+
if @exhibit.update(exhibit_params)
|
10
|
+
notice = t(:'helpers.submit.spotlight_default.updated', model: @exhibit.class.model_name.human.downcase)
|
11
|
+
redirect_to edit_exhibit_appearance_path(@exhibit), notice: notice
|
12
|
+
else
|
13
|
+
render 'edit'
|
14
|
+
end
|
11
15
|
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def edit
|
15
|
-
add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
|
16
|
-
add_breadcrumb t(:'spotlight.administration.sidebar.header'), exhibit_dashboard_path(@exhibit)
|
17
|
-
add_breadcrumb t(:'spotlight.administration.sidebar.appearance'), edit_exhibit_appearance_path(@exhibit)
|
18
|
-
end
|
19
16
|
|
20
|
-
|
17
|
+
def edit
|
18
|
+
add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
|
19
|
+
add_breadcrumb t(:'spotlight.administration.sidebar.header'), exhibit_dashboard_path(@exhibit)
|
20
|
+
add_breadcrumb t(:'spotlight.administration.sidebar.appearance'), edit_exhibit_appearance_path(@exhibit)
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
@appearance = @exhibit.appearance
|
24
|
-
authorize! action_name.to_sym, @appearance
|
25
|
-
end
|
23
|
+
protected
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
thumbnail: featured_image_params)
|
33
|
-
end
|
25
|
+
def exhibit_params
|
26
|
+
params.require(:exhibit).permit(main_navigations_attributes: [:id, :display, :label, :weight],
|
27
|
+
masthead_attributes: featured_image_params,
|
28
|
+
thumbnail_attributes: featured_image_params)
|
29
|
+
end
|
34
30
|
|
35
|
-
|
36
|
-
|
31
|
+
def featured_image_params
|
32
|
+
[
|
33
|
+
:display,
|
34
|
+
:source,
|
35
|
+
:image,
|
36
|
+
:remote_image_url,
|
37
|
+
:document_global_id,
|
38
|
+
:image_crop_x, :image_crop_y, :image_crop_w, :image_crop_h
|
39
|
+
]
|
40
|
+
end
|
37
41
|
end
|
38
42
|
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
require 'spotlight'
|
2
2
|
|
3
3
|
module Spotlight
|
4
|
+
##
|
4
5
|
# Inherit from the host app's ApplicationController
|
5
6
|
# This will configure e.g. the layout used by the host
|
6
7
|
class ApplicationController < ::ApplicationController
|
7
8
|
include Spotlight::Concerns::ApplicationController
|
8
9
|
|
9
|
-
|
10
|
+
before_action do
|
10
11
|
flash.now[:notice] = flash[:notice].html_safe if flash[:html_safe] && flash[:notice]
|
11
12
|
end
|
12
13
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
module Spotlight
|
2
|
+
##
|
3
|
+
# Create image attachments for the sir-trevor image widget
|
2
4
|
class AttachmentsController < ApplicationController
|
3
|
-
|
4
|
-
load_and_authorize_resource :exhibit, class:
|
5
|
+
before_action :authenticate_user!
|
6
|
+
load_and_authorize_resource :exhibit, class: 'Spotlight::Exhibit'
|
5
7
|
load_and_authorize_resource through: :exhibit
|
6
8
|
|
7
9
|
# POST /attachments
|
8
10
|
def create
|
9
11
|
@attachment.attributes = attachment_params
|
10
12
|
if @attachment.save
|
11
|
-
render :
|
13
|
+
render json: @attachment
|
12
14
|
else
|
13
15
|
render action: 'new'
|
14
16
|
end
|
@@ -16,9 +18,9 @@ module Spotlight
|
|
16
18
|
|
17
19
|
private
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
# Only allow a trusted parameter "white list" through.
|
22
|
+
def attachment_params
|
23
|
+
params.require(:attachment).permit(:name, :file, :uid)
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
@@ -1,15 +1,18 @@
|
|
1
1
|
module Spotlight
|
2
|
+
##
|
3
|
+
# Index and read actions for browse (see {Spotlight::SearchesController}
|
4
|
+
# for the curator's create-update-delete actions)
|
2
5
|
class BrowseController < Spotlight::ApplicationController
|
3
|
-
load_and_authorize_resource :exhibit, class:
|
6
|
+
load_and_authorize_resource :exhibit, class: 'Spotlight::Exhibit'
|
4
7
|
include Spotlight::Base
|
5
8
|
include Spotlight::Catalog::AccessControlsEnforcement
|
6
9
|
|
7
10
|
load_and_authorize_resource :search, except: :index, through: :exhibit, parent: false
|
8
|
-
|
11
|
+
before_action :attach_breadcrumbs
|
9
12
|
record_search_parameters only: :show
|
10
13
|
|
11
|
-
|
12
|
-
|
14
|
+
before_action :set_masthead, only: :show
|
15
|
+
|
13
16
|
def index
|
14
17
|
@searches = @exhibit.searches.published
|
15
18
|
end
|
@@ -18,10 +21,11 @@ module Spotlight
|
|
18
21
|
blacklight_config.index.document_actions = blacklight_config.browse.document_actions
|
19
22
|
|
20
23
|
add_breadcrumb @search.title, exhibit_browse_path(@exhibit, @search)
|
21
|
-
(@response, @document_list) =
|
24
|
+
(@response, @document_list) = search_results(@search.query_params.with_indifferent_access.merge(params), search_params_logic)
|
22
25
|
end
|
23
|
-
|
26
|
+
|
24
27
|
protected
|
28
|
+
|
25
29
|
##
|
26
30
|
# Browsing an exhibit should start a new search session
|
27
31
|
def start_new_search_session?
|
@@ -31,12 +35,12 @@ module Spotlight
|
|
31
35
|
# WARNING: Blacklight::Catalog::SearchContext sets @searches in history_session in a before_filter
|
32
36
|
# See https://github.com/projectblacklight/blacklight/pull/780
|
33
37
|
def history_session
|
34
|
-
#nop
|
38
|
+
# nop
|
35
39
|
end
|
36
40
|
|
37
41
|
def attach_breadcrumbs
|
38
42
|
add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
|
39
|
-
add_breadcrumb
|
43
|
+
add_breadcrumb((@exhibit.main_navigations.browse.label_or_default), exhibit_browse_index_path(@exhibit))
|
40
44
|
end
|
41
45
|
|
42
46
|
def _prefixes
|
@@ -44,7 +48,7 @@ module Spotlight
|
|
44
48
|
end
|
45
49
|
|
46
50
|
def set_masthead
|
47
|
-
self.current_masthead = @search.masthead if @search.masthead
|
51
|
+
self.current_masthead = @search.masthead if @search.masthead && @search.masthead.display?
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
@@ -1,213 +1,231 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
module Spotlight
|
2
|
+
##
|
3
|
+
# Spotlight's catalog controller. Note that this subclasses
|
4
|
+
# the host application's CatalogController to get its configuration,
|
5
|
+
# partial overrides, etc
|
6
|
+
# rubocop:disable Metrics/ClassLength
|
7
|
+
class CatalogController < ::CatalogController
|
8
|
+
include Spotlight::Concerns::ApplicationController
|
9
|
+
load_and_authorize_resource :exhibit, class: Spotlight::Exhibit, prepend: true
|
10
|
+
include Spotlight::Catalog
|
11
|
+
include Spotlight::Concerns::CatalogSearchContext
|
12
|
+
|
13
|
+
before_action :authenticate_user!, only: [:admin, :edit, :make_public, :make_private]
|
14
|
+
before_action :check_authorization, only: [:admin, :edit, :make_public, :make_private]
|
15
|
+
before_action :redirect_to_exhibit_home_without_search_params!, only: :index
|
16
|
+
before_action :add_breadcrumb_with_search_params, only: :index
|
17
|
+
|
18
|
+
before_action :attach_breadcrumbs
|
19
|
+
|
20
|
+
before_action only: :show do
|
21
|
+
blacklight_config.show.partials.unshift 'curation_mode_toggle'
|
22
|
+
end
|
23
|
+
|
24
|
+
before_action only: :admin do
|
25
|
+
blacklight_config.view.select! { |k, _v| k == :admin_table }
|
26
|
+
blacklight_config.view.admin_table.partials = [:index_compact]
|
27
|
+
blacklight_config.view.admin_table.document_actions = []
|
19
28
|
|
20
|
-
|
21
|
-
|
22
|
-
|
29
|
+
unless blacklight_config.sort_fields.key? :timestamp
|
30
|
+
blacklight_config.add_sort_field :timestamp, sort: "#{blacklight_config.index.timestamp_field} desc"
|
31
|
+
end
|
32
|
+
end
|
23
33
|
|
24
|
-
|
25
|
-
|
26
|
-
|
34
|
+
before_action only: :edit do
|
35
|
+
blacklight_config.view.edit.partials = blacklight_config.view_config(:show).partials.dup
|
36
|
+
blacklight_config.view.edit.partials.insert(2, :edit)
|
27
37
|
end
|
28
38
|
|
29
|
-
|
30
|
-
add_breadcrumb
|
31
|
-
add_breadcrumb
|
32
|
-
|
33
|
-
|
34
|
-
else
|
35
|
-
add_breadcrumb t(:'spotlight.catalog.breadcrumb.index'), search_action_url(current_search_session[:query_params]) if current_search_session
|
39
|
+
def new
|
40
|
+
add_breadcrumb t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)
|
41
|
+
add_breadcrumb t(:'spotlight.curation.sidebar.items'), admin_exhibit_catalog_index_path(@exhibit)
|
42
|
+
add_breadcrumb t(:'spotlight.catalog.new.header'), new_exhibit_catalog_path(@exhibit)
|
43
|
+
@resource = @exhibit.resources.build
|
36
44
|
end
|
37
|
-
add_breadcrumb Array(@document[blacklight_config.view_config(:show).title_field]).join(', '), exhibit_catalog_path(@exhibit, @document)
|
38
|
-
end
|
39
45
|
|
40
|
-
|
41
|
-
|
42
|
-
# setup within their index analyzer. This will ensure that this method returns
|
43
|
-
# results when a partial match is passed in the "q" parameter.
|
44
|
-
def autocomplete
|
45
|
-
(_, @document_list) = get_search_results(params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field), facet: false, "facet.field" => [], fq: ["-#{Spotlight::SolrDocument.visibility_field(current_exhibit)}:false"])
|
46
|
+
def show
|
47
|
+
super
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
render json: { docs: autocomplete_json_response(@document_list) }
|
49
|
+
if @document.private? current_exhibit
|
50
|
+
authenticate_user! && authorize!(:curate, current_exhibit)
|
50
51
|
end
|
51
|
-
end
|
52
|
-
end
|
53
52
|
|
54
|
-
|
55
|
-
|
56
|
-
self.blacklight_config.view.admin_table.partials = [:index_compact]
|
57
|
-
self.blacklight_config.view.admin_table.document_actions = []
|
53
|
+
add_document_breadcrumbs(@document)
|
54
|
+
end
|
58
55
|
|
59
|
-
|
60
|
-
|
56
|
+
# "id_ng" and "full_title_ng" should be defined in the Solr core's schema.xml.
|
57
|
+
# It's expected that these fields will be set up to have EdgeNGram filter
|
58
|
+
# setup within their index analyzer. This will ensure that this method returns
|
59
|
+
# results when a partial match is passed in the "q" parameter.
|
60
|
+
def autocomplete
|
61
|
+
search_params = params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field)
|
62
|
+
(_, @document_list) = search_results(search_params.merge(public: true), search_params_logic)
|
63
|
+
|
64
|
+
respond_to do |format|
|
65
|
+
format.json do
|
66
|
+
render json: { docs: autocomplete_json_response(@document_list) }
|
67
|
+
end
|
68
|
+
end
|
61
69
|
end
|
62
70
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
format
|
71
|
+
def admin
|
72
|
+
add_breadcrumb t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)
|
73
|
+
add_breadcrumb t(:'spotlight.curation.sidebar.items'), admin_exhibit_catalog_index_path(@exhibit)
|
74
|
+
(@response, @document_list) = search_results(params, search_params_logic)
|
75
|
+
@filters = params[:f] || []
|
76
|
+
|
77
|
+
respond_to do |format|
|
78
|
+
format.html
|
79
|
+
end
|
70
80
|
end
|
71
|
-
end
|
72
81
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
repository.connection.commit rescue nil
|
78
|
-
redirect_to exhibit_catalog_path(current_exhibit, @document)
|
79
|
-
end
|
82
|
+
def update
|
83
|
+
@response, @document = fetch params[:id]
|
84
|
+
@document.update(current_exhibit, solr_document_params)
|
85
|
+
@document.save
|
80
86
|
|
81
|
-
|
82
|
-
@response, @document = fetch params[:id]
|
83
|
-
blacklight_config.view.edit.partials = blacklight_config.view_config(:show).partials.dup
|
84
|
-
blacklight_config.view.edit.partials.insert(2, :edit)
|
85
|
-
end
|
87
|
+
try_solr_commit!
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
-
@document.make_private!(current_exhibit)
|
90
|
-
@document.save
|
89
|
+
redirect_to exhibit_catalog_path(current_exhibit, @document)
|
90
|
+
end
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
format.json { render json: true }
|
92
|
+
def edit
|
93
|
+
@response, @document = fetch params[:id]
|
95
94
|
end
|
96
|
-
end
|
97
95
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
96
|
+
def make_private
|
97
|
+
@response, @document = fetch params[:catalog_id]
|
98
|
+
@document.make_private!(current_exhibit)
|
99
|
+
@document.save
|
102
100
|
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
respond_to do |format|
|
102
|
+
format.html { redirect_to :back }
|
103
|
+
format.json { render json: true }
|
104
|
+
end
|
106
105
|
end
|
107
|
-
end
|
108
106
|
|
109
|
-
|
107
|
+
def make_public
|
108
|
+
@response, @document = fetch params[:catalog_id]
|
109
|
+
@document.make_public!(current_exhibit)
|
110
|
+
@document.save
|
110
111
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
112
|
+
respond_to do |format|
|
113
|
+
format.html { redirect_to :back }
|
114
|
+
format.json { render json: true }
|
115
|
+
end
|
116
|
+
end
|
115
117
|
|
116
|
-
|
117
|
-
|
118
|
-
#
|
119
|
-
#
|
120
|
-
|
121
|
-
|
122
|
-
|
118
|
+
protected
|
119
|
+
|
120
|
+
# TODO: move this out of app/helpers/blacklight/catalog_helper_behavior.rb and into blacklight/catalog.rb
|
121
|
+
# rubocop:disable Style/PredicateName
|
122
|
+
def has_search_parameters?
|
123
|
+
!params[:q].blank? || !params[:f].blank? || !params[:search_field].blank?
|
124
|
+
end
|
125
|
+
# rubocop:enable Style/PredicateName
|
126
|
+
|
127
|
+
def attach_breadcrumbs
|
128
|
+
# The "q: ''" is necessary so that the breadcrumb builder recognizes that a path like this:
|
129
|
+
# /exhibits/1?f%5Bgenre_sim%5D%5B%5D=map&q= is not the same as /exhibits/1
|
130
|
+
# Otherwise the exhibit breadcrumb won't be a link.
|
131
|
+
# see http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-current_page-3F
|
132
|
+
add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), exhibit_root_path(@exhibit, q: '')
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Override Blacklight's #setup_next_and_previous_documents to handle
|
137
|
+
# browse categories too
|
138
|
+
def setup_next_and_previous_documents
|
139
|
+
if current_browse_category
|
140
|
+
setup_next_and_previous_documents_from_browse_category
|
141
|
+
elsif current_page_context
|
142
|
+
# TODO: figure out how to construct previous/next documents
|
143
|
+
else
|
144
|
+
super
|
145
|
+
end
|
146
|
+
end
|
123
147
|
|
124
|
-
|
125
|
-
# Override Blacklight's #setup_next_and_previous_documents to handle
|
126
|
-
# browse categories too
|
127
|
-
def setup_next_and_previous_documents
|
128
|
-
if current_browse_category
|
148
|
+
def setup_next_and_previous_documents_from_browse_category
|
129
149
|
index = search_session['counter'].to_i - 1
|
130
150
|
response, documents = get_previous_and_next_documents_for_search index, current_browse_category.query_params.with_indifferent_access
|
131
151
|
search_session['total'] = response.total
|
132
|
-
@search_context_response = response
|
133
152
|
@previous_document = documents.first
|
134
153
|
@next_document = documents.last
|
135
|
-
elsif current_page_context
|
136
|
-
# TODO: figure out how to construct previous/next documents
|
137
|
-
else
|
138
|
-
super
|
139
154
|
end
|
140
|
-
end
|
141
155
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
##
|
147
|
-
# Admin catalog controller should not create a new search
|
148
|
-
# session in the blacklight context
|
149
|
-
def start_new_search_session?
|
150
|
-
super || params[:action] == 'admin'
|
151
|
-
end
|
156
|
+
def _prefixes
|
157
|
+
@_prefixes ||= super + ['catalog']
|
158
|
+
end
|
152
159
|
|
153
|
-
|
154
|
-
|
155
|
-
|
160
|
+
##
|
161
|
+
# Admin catalog controller should not create a new search
|
162
|
+
# session in the blacklight context
|
163
|
+
def start_new_search_session?
|
164
|
+
super || params[:action] == 'admin'
|
165
|
+
end
|
156
166
|
|
157
|
-
|
158
|
-
|
159
|
-
|
167
|
+
def solr_document_params
|
168
|
+
params.require(:solr_document).permit(:exhibit_tag_list,
|
169
|
+
uploaded_resource: [:url],
|
170
|
+
sidecar: [:public, data: [editable_solr_document_params]])
|
171
|
+
end
|
160
172
|
|
161
|
-
|
162
|
-
|
163
|
-
[{configured_fields: Spotlight::Resources::Upload.fields(current_exhibit).collect(&:field_name)}]
|
164
|
-
else
|
165
|
-
[]
|
173
|
+
def editable_solr_document_params
|
174
|
+
custom_field_params + uploaded_resource_params
|
166
175
|
end
|
167
|
-
end
|
168
176
|
|
169
|
-
|
170
|
-
|
171
|
-
|
177
|
+
def uploaded_resource_params
|
178
|
+
if @document.uploaded_resource?
|
179
|
+
[{ configured_fields: Spotlight::Resources::Upload.fields(current_exhibit).map(&:field_name) }]
|
180
|
+
else
|
181
|
+
[]
|
182
|
+
end
|
183
|
+
end
|
172
184
|
|
173
|
-
|
174
|
-
|
175
|
-
|
185
|
+
def custom_field_params
|
186
|
+
current_exhibit.custom_fields.pluck(:field)
|
187
|
+
end
|
176
188
|
|
177
|
-
|
178
|
-
|
179
|
-
current_exhibit.searches.accessible_by(current_ability).find(current_search_session.query_params["id"]) if current_search_session.query_params["id"]
|
189
|
+
def check_authorization
|
190
|
+
authorize! :curate, @exhibit
|
180
191
|
end
|
181
|
-
end
|
182
192
|
|
183
|
-
|
184
|
-
|
185
|
-
redirect_to spotlight.exhibit_root_path(@exhibit)
|
193
|
+
def redirect_to_exhibit_home_without_search_params!
|
194
|
+
redirect_to spotlight.exhibit_root_path(@exhibit) unless has_search_parameters?
|
186
195
|
end
|
187
|
-
end
|
188
196
|
|
189
|
-
|
190
|
-
|
191
|
-
add_breadcrumb t(:'spotlight.catalog.breadcrumb.index'), request.fullpath
|
197
|
+
def add_breadcrumb_with_search_params
|
198
|
+
add_breadcrumb t(:'spotlight.catalog.breadcrumb.index'), request.fullpath if has_search_parameters?
|
192
199
|
end
|
193
|
-
end
|
194
200
|
|
195
|
-
|
196
|
-
|
197
|
-
if
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
+
# rubocop:disable Metrics/AbcSize
|
202
|
+
def add_document_breadcrumbs(document)
|
203
|
+
if current_browse_category
|
204
|
+
add_breadcrumb current_browse_category.exhibit.main_navigations.browse.label_or_default, exhibit_browse_index_path(current_browse_category.exhibit)
|
205
|
+
add_breadcrumb current_browse_category.title, exhibit_browse_path(current_browse_category.exhibit, current_browse_category)
|
206
|
+
elsif current_page_context && current_page_context.title.present? && !current_page_context.is_a?(Spotlight::HomePage)
|
207
|
+
add_breadcrumb current_page_context.title, [current_page_context.exhibit, current_page_context]
|
208
|
+
elsif current_search_session
|
209
|
+
add_breadcrumb t(:'spotlight.catalog.breadcrumb.index'), search_action_url(current_search_session[:query_params])
|
201
210
|
end
|
211
|
+
|
212
|
+
add_breadcrumb Array(document[blacklight_config.view_config(:show).title_field]).join(', '), exhibit_catalog_path(current_exhibit, document)
|
202
213
|
end
|
203
|
-
|
214
|
+
# rubocop:enable Metrics/AbcSize
|
204
215
|
|
205
|
-
|
206
|
-
|
216
|
+
def additional_export_formats(document, format)
|
217
|
+
super
|
218
|
+
|
219
|
+
format.solr_json do
|
220
|
+
authorize! :update_solr, @exhibit
|
221
|
+
render json: document.to_solr.merge(@exhibit.solr_data)
|
222
|
+
end
|
223
|
+
end
|
207
224
|
|
208
|
-
|
209
|
-
|
210
|
-
|
225
|
+
def try_solr_commit!
|
226
|
+
repository.connection.commit
|
227
|
+
rescue => e
|
228
|
+
Rails.logger.info "Failed to commit document updates: #{e}"
|
211
229
|
end
|
212
230
|
end
|
213
231
|
end
|