Sha256: f00b8f776b6f68d5138b99e4bfd8e40c81282de3dea513f5974e42869d601428
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true module Hyrax class ContactForm include ActiveModel::Model attr_accessor :contact_method, :category, :name, :email, :subject, :message validates :email, :category, :name, :subject, :message, presence: true validates :email, format: /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i, allow_blank: true # - can't use this without ActiveRecord::Base validates_inclusion_of :category, in: self.class.issue_types_for_locale # They should not have filled out the `contact_method' field. That's there to prevent spam. def spam? contact_method.present? end # Declare the e-mail headers. It accepts anything the mail method # in ActionMailer accepts. def headers { subject: "#{Hyrax.config.subject_prefix} #{subject}", to: Hyrax.config.contact_email, from: email } end def self.issue_types_for_locale [ I18n.t('hyrax.contact_form.issue_types.depositing'), I18n.t('hyrax.contact_form.issue_types.changing'), I18n.t('hyrax.contact_form.issue_types.browsing'), I18n.t('hyrax.contact_form.issue_types.reporting'), I18n.t('hyrax.contact_form.issue_types.general') ] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hyrax-3.0.0.pre.rc3 | app/models/hyrax/contact_form.rb |
hyrax-3.0.0.pre.rc2 | app/models/hyrax/contact_form.rb |