Nicolae Claudius
13 years ago
11 changed files with 106 additions and 12 deletions
@ -0,0 +1,4 @@
|
||||
.send-contact-form { |
||||
font-size: 1.2em; |
||||
font-weight: bold; |
||||
} |
@ -0,0 +1,17 @@
|
||||
class ContactForm < MailForm::Base |
||||
attribute :name, :validate => true |
||||
attribute :email, :validate => true |
||||
attribute :message, :validate => true |
||||
attribute :file, :attachment => true, :allow_blank => true |
||||
attribute :nickname, :captcha => true # antispam |
||||
|
||||
# Declare the e-mail headers. It accepts anything the mail method |
||||
# in ActionMailer accepts. |
||||
def headers |
||||
{ |
||||
:subject => "#{name} Contact Form", |
||||
:to => Settings.support_mail, |
||||
:from => %("#{name}" <#{email}>) |
||||
} |
||||
end |
||||
end |
@ -0,0 +1,30 @@
|
||||
<%= form_for @contact_form, :url => {:action => 'contact'}, :method => 'post' do |f| %> |
||||
<%= error_messages_for(@contact_form) %> |
||||
|
||||
<div style="display:none;"> |
||||
<%= f.text_field :nickname %> |
||||
</div> |
||||
|
||||
<p> |
||||
<%= f.label :name, 'Your name' %><br /> |
||||
<%= f.text_field :name %> |
||||
</p> |
||||
|
||||
<p> |
||||
<%= f.label :email, 'Your email' %><br /> |
||||
<%= f.text_field :email %> |
||||
</p> |
||||
|
||||
<p> |
||||
<%= f.label :file %> <i>can be attached optionally</i><br /> |
||||
<%= f.file_field :file %> |
||||
</p> |
||||
|
||||
<p> |
||||
<%= f.label :message %><br /> |
||||
<%= f.text_area :message, :rows => 10 %> |
||||
</p> |
||||
|
||||
<p><%= f.submit 'Send', :class => 'send-contact-form' %></p> |
||||
|
||||
<% end %> |
Loading…
Reference in new issue