Class: Spotlight::ContactsController

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

Instance Method Summary collapse

Methods included from Controller

#blacklight_config, #current_exhibit, #exhibit_search_action_url, #exhibit_search_facet_url, #search_action_url, #search_facet_url

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#createObject



24
25
26
27
28
29
30
# File 'app/controllers/spotlight/contacts_controller.rb', line 24

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



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

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



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

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

#newObject



8
9
10
# File 'app/controllers/spotlight/contacts_controller.rb', line 8

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

#updateObject



16
17
18
19
20
21
22
# File 'app/controllers/spotlight/contacts_controller.rb', line 16

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