Class: Hyrax::ContactForm

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/hyrax/contact_form.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#categoryObject

Returns the value of attribute category


5
6
7
# File 'app/models/hyrax/contact_form.rb', line 5

def category
  @category
end

#contact_methodObject

Returns the value of attribute contact_method


5
6
7
# File 'app/models/hyrax/contact_form.rb', line 5

def contact_method
  @contact_method
end

#emailObject

Returns the value of attribute email


5
6
7
# File 'app/models/hyrax/contact_form.rb', line 5

def email
  @email
end

#messageObject

Returns the value of attribute message


5
6
7
# File 'app/models/hyrax/contact_form.rb', line 5

def message
  @message
end

#nameObject

Returns the value of attribute name


5
6
7
# File 'app/models/hyrax/contact_form.rb', line 5

def name
  @name
end

#subjectObject

Returns the value of attribute subject


5
6
7
# File 'app/models/hyrax/contact_form.rb', line 5

def subject
  @subject
end

Class Method Details

.issue_types_for_localeObject


26
27
28
# File 'app/models/hyrax/contact_form.rb', line 26

def self.issue_types_for_locale
  I18n.t('hyrax.contact_form.issue_types').values.select(&:present?)
end

Instance Method Details

#headersObject

Declare the e-mail headers. It accepts anything the mail method in ActionMailer accepts.


18
19
20
21
22
23
24
# File 'app/models/hyrax/contact_form.rb', line 18

def headers
  {
    subject: "#{Hyrax.config.subject_prefix} #{subject}",
    to: Hyrax.config.contact_email,
    from: email
  }
end

#spam?Boolean

They should not have filled out the `contact_method' field. That's there to prevent spam.

Returns:

  • (Boolean)

12
13
14
# File 'app/models/hyrax/contact_form.rb', line 12

def spam?
  contact_method.present?
end