Sha256: ac969c93281e30f7cf0d37099c6d0d662750e0a34a30912e77bb88118941483b

Contents?: true

Size: 1.63 KB

Versions: 16

Compression:

Stored size: 1.63 KB

Contents

# Copyright © 2012 The Pennsylvania State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 'mail_form'

class ContactForm < MailForm::Base
  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"]
    ] 
  attribute :contact_method,  :captcha  => true
  attribute :category,    :validate => true
  attribute :name,        :validate => true
  attribute :email,       :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
  attribute :subject,     :validate => true
  attribute :message,     :validate => true
  # - can't use this without ActiveRecord::Base validates_inclusion_of :issue_type, :in => ISSUE_TYPES

  # Declare the e-mail headers. It accepts anything the mail method
  # in ActionMailer accepts.
  def headers
    {
      :subject => "Contact Form:#{subject}",
      :to => Sufia::Engine.config.contact_email, 
      :from => Sufia::Engine.config.from_email
    }
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
sufia-1.3.0 app/models/contact_form.rb
sufia-models-0.0.2 app/models/contact_form.rb
sufia-models-0.0.1 app/models/contact_form.rb
sufia-1.2.0 app/models/contact_form.rb
sufia-1.1.0 app/models/contact_form.rb
sufia-1.0.0 app/models/contact_form.rb
sufia-0.1.0 app/models/contact_form.rb
sufia-0.0.8 app/models/contact_form.rb
sufia-0.0.7 app/models/contact_form.rb
sufia-0.0.6 app/models/contact_form.rb
sufia-0.0.5 app/models/contact_form.rb
sufia-0.0.4 app/models/contact_form.rb
sufia-0.0.3 app/models/contact_form.rb
sufia-0.0.2 app/models/contact_form.rb
sufia-0.0.1 app/models/contact_form.rb
sufia-0.0.1.pre2 app/models/contact_form.rb