Sha256: fdbd017109518c395fa1a7d59cae9fa7315988caed089fb0f6061d1130d7e03e

Contents?: true

Size: 799 Bytes

Versions: 23

Compression:

Stored size: 799 Bytes

Contents

module Sufia
  module ContactFormControllerBehavior

  def new
    @contact_form = ContactForm.new
  end

  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.full_messages.map { |s| s.to_s }.join(",")
      render :new
    end
  rescue 
      flash[:error] = 'Sorry, this message was not delivered.'
      render :new
  end

  def after_deliver
     return unless Sufia::Engine.config.enable_contact_form_delivery
  end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
sufia-4.0.1 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-4.0.0 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-4.0.0.rc2 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-4.0.0.rc1 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-4.0.0.beta4 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-4.0.0.beta3 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-4.0.0.beta2 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-4.0.0.beta1 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.7.2 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.7.1 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.7.0 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.6.1 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.6.0 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.5.0 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.4.0 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.4.0.rc4 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.4.0.rc3 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.3.1 lib/sufia/contact_form_controller_behavior.rb
sufia-3.4.0.rc2 app/controllers/concerns/sufia/contact_form_controller_behavior.rb
sufia-3.4.0.rc1 app/controllers/concerns/sufia/contact_form_controller_behavior.rb