Class: Spotlight::CatalogController
- Inherits:
-
CatalogController
- Object
- ApplicationController
- CatalogController
- Spotlight::CatalogController
- Includes:
- Blacklight::Catalog, Catalog, Spotlight::Concerns::ApplicationController, Spotlight::Concerns::CatalogSearchContext
- Defined in:
- app/controllers/spotlight/catalog_controller.rb
Overview
Spotlight’s catalog controller. Note that this subclasses the host application’s CatalogController to get its configuration, partial overrides, etc rubocop:disable Metrics/ClassLength
Direct Known Subclasses
Instance Method Summary collapse
- #admin ⇒ Object
-
#autocomplete ⇒ Object
“id_ng” and “full_title_ng” should be defined in the Solr core’s schema.xml.
- #edit ⇒ Object
- #make_private ⇒ Object
- #make_public ⇒ Object
- #manifest ⇒ Object
- #select_image ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from Catalog
#add_facet_visibility_field, #render_curator_actions?
Methods included from SearchHelper
#search_service, #search_service_context
Methods included from Base
#autocomplete_json_response, #autocomplete_json_response_for_document, #blacklight_config, #controller_tracking_method
Methods included from Config
#exhibit_specific_blacklight_config
Methods included from Spotlight::Concerns::ApplicationController
#enabled_in_spotlight_view_type_configuration?, #field_enabled?
Methods included from Controller
#add_breadcrumb, #blacklight_config, #breadcrumbs, #current_exhibit, #current_masthead, #current_masthead=, #current_site, #default_url_options, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_path, #resource_masthead?, #search_action_url, #search_facet_path, #search_state, #set_exhibit_locale_scope, #set_locale
Instance Method Details
#admin ⇒ Object
79 80 81 82 83 84 85 86 87 88 |
# File 'app/controllers/spotlight/catalog_controller.rb', line 79 def admin (t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)) (t(:'spotlight.curation.sidebar.items'), admin_exhibit_catalog_path(@exhibit)) @response = search_service.search_results @filters = params[:f] || [] respond_to do |format| format.html end end |
#autocomplete ⇒ Object
“id_ng” and “full_title_ng” should be defined in the Solr core’s schema.xml. It’s expected that these fields will be set up to have EdgeNGram filter setup within their index analyzer. This will ensure that this method returns results when a partial match is passed in the “q” parameter.
67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/spotlight/catalog_controller.rb', line 67 def autocomplete @response = search_service.search_results do |builder| builder.with(builder.blacklight_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field, public: true, rows: 100)) end respond_to do |format| format.json do render json: { docs: autocomplete_json_response(@response.documents) } end end end |
#edit ⇒ Object
90 |
# File 'app/controllers/spotlight/catalog_controller.rb', line 90 def edit; end |
#make_private ⇒ Object
101 102 103 104 105 106 107 108 109 |
# File 'app/controllers/spotlight/catalog_controller.rb', line 101 def make_private @document.make_private!(current_exhibit) @document.save respond_to do |format| format.html { redirect_back(fallback_location: [spotlight, current_exhibit, @document]) } format.json { render json: true } end end |
#make_public ⇒ Object
111 112 113 114 115 116 117 118 119 |
# File 'app/controllers/spotlight/catalog_controller.rb', line 111 def make_public @document.make_public!(current_exhibit) @document.save respond_to do |format| format.html { redirect_back(fallback_location: [spotlight, current_exhibit, @document]) } format.json { render json: true } end end |
#manifest ⇒ Object
121 122 123 124 125 126 127 |
# File 'app/controllers/spotlight/catalog_controller.rb', line 121 def manifest if @document.uploaded_resource? render json: Spotlight::IiifManifestPresenter.new(@document, self).iiif_manifest_json else head :not_found end end |
#select_image ⇒ Object
129 130 131 132 133 |
# File 'app/controllers/spotlight/catalog_controller.rb', line 129 def select_image @index_id = params[:index_id] @block_item_id = params[:block_item_id] respond_to :html end |
#show ⇒ Object
55 56 57 58 59 60 61 |
# File 'app/controllers/spotlight/catalog_controller.rb', line 55 def show super authenticate_user! && (:curate, current_exhibit) if @document.private? current_exhibit (@document) end |
#update ⇒ Object
92 93 94 95 96 97 98 99 |
# File 'app/controllers/spotlight/catalog_controller.rb', line 92 def update @document.update(current_exhibit, solr_document_params) @document.save try_solr_commit! redirect_to polymorphic_path([current_exhibit, @document]) end |