Module: Sufia::ContactFormControllerBehavior
- Included in:
- ContactFormController
- Defined in:
- lib/sufia/contact_form_controller_behavior.rb
Instance Method Summary collapse
Instance Method Details
#after_deliver ⇒ Object
41 42 43 |
# File 'lib/sufia/contact_form_controller_behavior.rb', line 41 def after_deliver return unless Sufia::Engine.config.enable_contact_form_delivery end |
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sufia/contact_form_controller_behavior.rb', line 22 def create @contact_form = ContactForm.new(params[:contact_form]) @contact_form.request = request # not spam and a valid form logger.warn "*** MARK ***" if @contact_form.deliver flash.now[:notice] = 'Thank you for your message!' after_deliver render :new else flash[:error] = 'Sorry, this message was not sent successfully. ' flash[:error] << @contact_form.errors..map { |s| s.to_s }.join(",") render :new end rescue flash[:error] = 'Sorry, this message was not delivered.' render :new end |
#new ⇒ Object
18 19 20 |
# File 'lib/sufia/contact_form_controller_behavior.rb', line 18 def new @contact_form = ContactForm.new end |