Sha256: a1f1dd0264968d9d550ccdef4cfac9a62582529dbdaf3a850f3d31621d6091fd

Contents?: true

Size: 797 Bytes

Versions: 62

Compression:

Stored size: 797 Bytes

Contents

module Workarea
  class Storefront::ContactsController < Storefront::ApplicationController
    def show
      model = Inquiry.new(inquiry_params)
      @inquiry = Storefront::InquiryViewModel.new(model)
    end

    def create
      inquiry = Inquiry.new(inquiry_params)

      if inquiry.save
        flash[:success] = t('workarea.storefront.flash_messages.contact_message_sent')
        Storefront::InquiryMailer.created(inquiry.id.to_s).deliver_later
        redirect_to contact_path
      else
        flash[:error] = t('workarea.storefront.flash_messages.contact_error')
        @inquiry = Storefront::InquiryViewModel.new(inquiry)
        render :show
      end
    end

    private

    def inquiry_params
      params.permit(:name, :email, :order_id, :subject, :message)
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.4.27 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.4 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.26 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.3 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.25 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.2 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.24 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.1 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.23 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.22 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.0 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.21 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.0.beta.1 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.20 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.19 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.18 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.17 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.16 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.15 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.14 app/controllers/workarea/storefront/contacts_controller.rb