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.5.15 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.36 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.14 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.35 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.13 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.34 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.12 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.33 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.11 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.10 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.32 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.9 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.31 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.8 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.30 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.7 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.29 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.6 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.4.28 app/controllers/workarea/storefront/contacts_controller.rb
workarea-storefront-3.5.5 app/controllers/workarea/storefront/contacts_controller.rb