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, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_url, #resource_masthead?, #search_action_url, #search_facet_url

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#createObject



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

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



35
36
37
38
# File 'app/controllers/spotlight/contacts_controller.rb', line 35

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



15
16
17
# File 'app/controllers/spotlight/contacts_controller.rb', line 15

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

#newObject



11
12
13
# File 'app/controllers/spotlight/contacts_controller.rb', line 11

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

#updateObject



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

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