Class: Spotlight::ContactFormsController

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

Instance Method Summary collapse

Methods included from Controller

#blacklight_config, #current_exhibit, #current_masthead, #current_masthead=, #default_masthead?, #exhibit_masthead?, #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



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/spotlight/contact_forms_controller.rb', line 9

def create
  @contact_form = Spotlight::ContactForm.new(contact_form_params)
  @contact_form.current_exhibit = current_exhibit
  @contact_form.request = request

  if @contact_form.valid?
    if @contact_form.respond_to? :deliver_now
      @contact_form.deliver_now
    else
      @contact_form.deliver
    end

    redirect_to :back, notice: t(:'helpers.submit.contact_form.created')
  else
    render 'new' 
  end
  
end

#newObject



5
6
7
# File 'app/controllers/spotlight/contact_forms_controller.rb', line 5

def new
  @contact_form = Spotlight::ContactForm.new :current_url => request.referer
end