Class: Spotlight::ContactsController

Inherits:
ApplicationController
  • Object
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

Instance Method Details

#create ⇒ Object



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

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

#destroy ⇒ Object



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

#edit ⇒ Object



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

#new ⇒ Object



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

#update ⇒ Object



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

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