Class: Spotlight::LanguagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/spotlight/languages_controller.rb

Overview

Create and update languages for an exhibit

Instance Method Summary collapse

Methods included from Concerns::ApplicationController

#enabled_in_spotlight_view_type_configuration?, #field_enabled?

Methods included from Controller

#blacklight_config, #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

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/spotlight/languages_controller.rb', line 21

def create
  if @language.save && @cloned_home_page.save
    flash[:notice] = t('helpers.submit.language.created', model: @language.model_name.human.downcase)
  else
    flash[:alert] = [
      @language.errors.full_messages,
      @cloned_home_page.errors.full_messages
    ].join('<br/>'.html_safe)
  end
  redirect_to spotlight.edit_exhibit_path @exhibit, tab: 'language'
end

#destroyObject



33
34
35
36
37
38
39
40
# File 'app/controllers/spotlight/languages_controller.rb', line 33

def destroy
  @language.destroy

  redirect_to(
    spotlight.edit_exhibit_path(@exhibit, tab: 'language'),
    notice: t(:'helpers.submit.language.destroyed', model: @language.model_name.human.downcase)
  )
end