Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

start project view

  • Loading branch information...
commit eef80b58347ea7336c4530f2c5ea9c39823e4239 1 parent f386373
Antônio Roberto Silva authored April 17, 2012
7  app/controllers/projects_controller.rb
@@ -56,9 +56,16 @@ def start
56 56
   def send_mail
57 57
     current_user.update_attribute :email, params[:contact] if current_user.email.nil?
58 58
     ProjectsMailer.start_project_email(
  59
+      params[:how_much_you_need],
  60
+      params[:category],
59 61
       params[:about],
60 62
       params[:rewards],
  63
+      params[:video],
  64
+      params[:twitter],
  65
+      params[:blog],
61 66
       params[:links],
  67
+      params[:know_us_via],
  68
+      params[:how_works],
62 69
       params[:contact],
63 70
       current_user,
64 71
       "#{I18n.t('site.base_url')}#{user_path(current_user)}").deliver
9  app/mailers/projects_mailer.rb
... ...
@@ -1,10 +1,17 @@
1 1
 class ProjectsMailer < ActionMailer::Base
2 2
   include ERB::Util
3 3
 
4  
-  def start_project_email(about, rewards, links, contact, user, user_url)
  4
+  def start_project_email(how_much_you_need, category, about, rewards, video, twitter, blog, links, know_us_via, how_works, contact, user, user_url)
  5
+    @how_much_you_need = h(how_much_you_need)
  6
+    @category = h(category)
5 7
     @about = h(about).gsub("\n", "<br>").html_safe
6 8
     @rewards = h(rewards).gsub("\n", "<br>").html_safe
  9
+    @video = h(video)
  10
+    @twitter = h(twitter)
  11
+    @blog = h(blog)
7 12
     @links = h(links).gsub("\n", "<br>").html_safe
  13
+    @know_us_via = h(know_us_via).gsub("\n", "<br>").html_safe
  14
+    @how_works = h(how_works).gsub("\n", "<br>").html_safe
8 15
     @contact = contact
9 16
     @user = user
10 17
     @user_url = user_url
14  app/views/projects_mailer/start_project_email.html.haml
@@ -3,11 +3,25 @@
3 3
     %meta{:content => "text/html; charset=UTF-8", 'http-equiv' => "Content-Type"}
4 4
   %body
5 5
     %h1= t('.subject_html', :link => link_to(@user.display_name, @user_url))
  6
+    %h2= t('projects.start.how_much_you_need')
  7
+    %p= @how_much_you_need
  8
+    %h2= t('projects.start.category')
  9
+    %p= @category
6 10
     %h2= t('projects.start.about')
7 11
     %p= @about
8 12
     %h2= t('projects.start.rewards')
9 13
     %p= @rewards
  14
+    %h2= t('projects.start.video')
  15
+    %p= @video
  16
+    %h2= t('projects.start.twitter')
  17
+    %p= @twitter
  18
+    %h2= t('projects.start.blog')
  19
+    %p= @blog
10 20
     %h2= t('projects.start.links')
11 21
     %p= @links
  22
+    %h2= t('projects.start.know_us_via')
  23
+    %p= @know_us_via
  24
+    %h2= t('projects.start.how_works')
  25
+    %p= @how_works
12 26
     %h2= t('projects.start.contact')
13 27
     %p= @contact
11  spec/mailers/projects_mailer_spec.rb
@@ -2,16 +2,25 @@
2 2
 
3 3
 describe ProjectsMailer do
4 4
   it "should send project, with HTML-safe fields and converting new lines to <br>" do
  5
+    how_much_you_need = "1000 <javascript>"
  6
+    category = "art <javascript>"
5 7
     about = "About the project\n<javascript>"
6 8
     rewards = "Rewards of the project\n<javascript>"
  9
+    video = "http://vimeo.com/9090 <javascript>"
  10
+    twitter = "username <javascript>"
  11
+    blog = "www.lorem.com <javascript>"
7 12
     links = "Links of the project\n<javascript>"
  13
+    know_us_via = "My friends\n<javascript>"
  14
+    how_works = "Through social networks\n<javascript>"
8 15
     contact = "foo@bar.com"
9 16
     user = Factory(:user)
10  
-    email = ProjectsMailer.start_project_email(about, rewards, links, contact, user, "#{I18n.t('site.base_url')}#{user_path(user)}").deliver
  17
+    email = ProjectsMailer.start_project_email(how_much_you_need, category, about, rewards, video, twitter, blog, links, know_us_via, how_works, contact, user, "#{I18n.t('site.base_url')}#{user_path(user)}").deliver
11 18
     ActionMailer::Base.deliveries.should_not be_empty
  19
+    email.encoded.should =~ /1000 &lt;javascript&gt;/
12 20
     email.encoded.should =~ /About the project\<br\>&lt;javascript&gt;/
13 21
     email.encoded.should =~ /Rewards of the project\<br\>&lt;javascript&gt;/
14 22
     email.encoded.should =~ /Links of the project\<br\>&lt;javascript&gt;/
  23
+    email.encoded.should =~ /Through social networks\<br\>&lt;javascript&gt;/
15 24
     email.encoded.should =~ /foo@bar.com/
16 25
     email[:from].to_s.should == "#{I18n.t('site.name')} <#{I18n.t('site.email.system')}>"
17 26
   end

0 notes on commit eef80b5

Please sign in to comment.
Something went wrong with that request. Please try again.