Class: Spotlight::SearchConfigurationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
SearchHelper
Defined in:
app/controllers/spotlight/search_configurations_controller.rb

Overview

CRUD actions for Blacklight search configuration

Instance Method Summary collapse

Methods included from SearchHelper

#search_service, #search_service_context

Instance Method Details

#edit ⇒ Object



21
22
23
24
25
26
27
# File 'app/controllers/spotlight/search_configurations_controller.rb', line 21

def edit
  add_breadcrumb(t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit)
  add_breadcrumb(t(:'spotlight.configuration.sidebar.header'), exhibit_dashboard_path(@exhibit))
  add_breadcrumb(t(:'spotlight.configuration.sidebar.search_configuration'), edit_exhibit_search_configuration_path(@exhibit))

   = Spotlight::.new(current_exhibit, blacklight_config.repository, @blacklight_configuration.blacklight_config)
end

#show ⇒ Object



13
14
15
16
17
18
19
# File 'app/controllers/spotlight/search_configurations_controller.rb', line 13

def show
  respond_to do |format|
    format.json do
      render json: @blacklight_configuration.default_blacklight_config.view.to_h.reject { |_k, v| v.if == false }.keys
    end
  end
end

#update ⇒ Object



29
30
31
32
33
34
35
36
# File 'app/controllers/spotlight/search_configurations_controller.rb', line 29

def update
  if @blacklight_configuration.update(exhibit_params)
    flash[:notice] = t(:'helpers.submit.blacklight_configuration.updated', model: @blacklight_configuration.class.model_name.human.downcase)
    redirect_to edit_exhibit_search_configuration_path(@exhibit)
  else
    render action: 'edit'
  end
end