Class: Sufia::ContactForm

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

Constant Summary collapse

ISSUE_TYPES =
[
  ["Depositing content", "Depositing content"],
  ["Making changes to my content", "Making changes to my content"],
  ["Browsing and searching", "Browsing and searching"],
  ["Reporting a problem", "Reporting a problem"],
  ["General inquiry or request", "General inquiry or request"]
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



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

def category
  @category
end

#contact_methodObject

Returns the value of attribute contact_method.



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

def contact_method
  @contact_method
end

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#subjectObject

Returns the value of attribute subject.



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

def subject
  @subject
end

Instance Method Details

#headersObject

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



25
26
27
28
29
30
31
# File 'app/models/sufia/contact_form.rb', line 25

def headers
  {
    subject: "#{Sufia.config.subject_prefix} #{subject}",
    to: Sufia.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)


19
20
21
# File 'app/models/sufia/contact_form.rb', line 19

def spam?
  contact_method.present?
end