Class: Spotlight::ContactsController

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

Overview

CRUD actions for exhibit curator contacts (not to be confused with email addresses for receiving feedback messages, see ExhibitsController)

Instance Method Summary collapse

Methods included from Spotlight::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_url, #resource_masthead?, #search_action_url, #search_facet_url, #set_exhibit_locale_scope, #set_locale

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#createObject



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

def create
  if @contact.update(contact_params)
    redirect_to exhibit_about_pages_path(@contact.exhibit), notice: t(:'helpers.submit.contact.created', model: @contact.class.model_name.human.downcase)
  else
    render 'new'
  end
end

#destroyObject



37
38
39
40
# File 'app/controllers/spotlight/contacts_controller.rb', line 37

def destroy
  @contact.destroy
  redirect_to exhibit_about_pages_path(@contact.exhibit), notice: t(:'helpers.submit.contact.destroyed', model: @contact.class.model_name.human.downcase)
end

#editObject



17
18
19
# File 'app/controllers/spotlight/contacts_controller.rb', line 17

def edit
  add_breadcrumb @contact.name, edit_exhibit_contact_path(@contact.exhibit, @contact)
end

#newObject



13
14
15
# File 'app/controllers/spotlight/contacts_controller.rb', line 13

def new
  add_breadcrumb t(:'helpers.action.spotlight/contact.create'), new_exhibit_contact_path(@exhibit)
end

#updateObject



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

def update
  if @contact.update(contact_params)
    redirect_to exhibit_about_pages_path(@contact.exhibit), notice: t(:'helpers.submit.contact.updated', model: @contact.class.model_name.human.downcase)
  else
    render 'edit'
  end
end