Sha256: 993500b2df4680833cc2003b214c7e125616088aeed160c685766832a6ba070c

Contents?: true

Size: 565 Bytes

Versions: 2

Compression:

Stored size: 565 Bytes

Contents

require 'mail_form'

module Spotlight
  class ContactForm < MailForm::Base
    attribute :name, validate: false
    attribute :email, validate: /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
    attribute :message
    attribute :current_url

    append :remote_ip, :user_agent

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blacklight-spotlight-0.0.2 app/models/spotlight/contact_form.rb
blacklight-spotlight-0.0.1 app/models/spotlight/contact_form.rb