Sha256: 2da12bc4ed1e2f87cd5b8feeb324d575a4a17a91caa4ff307404b6198bc53813

Contents?: true

Size: 636 Bytes

Versions: 22

Compression:

Stored size: 636 Bytes

Contents

module Spotlight
  ##
  # Exhibit feedback form
  class ContactForm
    include ActiveModel::Model

    attr_accessor :current_exhibit, :name, :email, :message, :current_url, :request

    validates :email, format: { with: /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i }

    def headers
      {
        to: to,
        subject: "#{I18n.t(:'blacklight.application_name')} Contact Form",
        from: %("#{name}" <#{email}>),
        cc: current_exhibit.contact_emails.join(', ')
      }
    end

    private

    def to
      Spotlight::Engine.config.default_contact_email || current_exhibit.contact_emails.first.to_s
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-spotlight-0.30.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.29.1 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.29.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.28.3 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.28.2 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.28.1 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.28.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.27.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.26.1 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.26.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.25.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.24.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.23.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.22.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.21.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.20.3 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.20.2 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.20.1 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.20.0 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.19.2 app/models/spotlight/contact_form.rb