Commit 4bb32eacc4cba17e13c5f3c5673dc4ec4a2470fc
1 parent
aa29773a
Exists in
master
and in
29 other branches
user-mailer: move mailer views to correct folder
ActionItem3174
Showing
7 changed files
with
33 additions
and
61 deletions
Show diff stats
app/mailers/user_mailer.rb
@@ -15,10 +15,12 @@ class UserMailer < ActionMailer::Base | @@ -15,10 +15,12 @@ class UserMailer < ActionMailer::Base | ||
15 | end | 15 | end |
16 | 16 | ||
17 | def activation_code(user) | 17 | def activation_code(user) |
18 | - @recipient = user.name, | 18 | + @recipient = user.name |
19 | @activation_code = user.activation_code | 19 | @activation_code = user.activation_code |
20 | @environment = user.environment.name | 20 | @environment = user.environment.name |
21 | @url = user.environment.top_url | 21 | @url = user.environment.top_url |
22 | + @redirection = (true if user.return_to) | ||
23 | + @join = (user.community_to_join if user.community_to_join) | ||
22 | 24 | ||
23 | mail( | 25 | mail( |
24 | from: "#{user.environment.name} <#{user.environment.contact_email}>", | 26 | from: "#{user.environment.name} <#{user.environment.contact_email}>", |
app/models/user.rb
@@ -66,45 +66,6 @@ class User < ActiveRecord::Base | @@ -66,45 +66,6 @@ class User < ActiveRecord::Base | ||
66 | # virtual attribute used to stash which community to join on signup or login | 66 | # virtual attribute used to stash which community to join on signup or login |
67 | attr_accessor :community_to_join | 67 | attr_accessor :community_to_join |
68 | 68 | ||
69 | - class Mailer < ActionMailer::Base | ||
70 | - def activation_email_notify(user) | ||
71 | - user_email = "#{user.login}@#{user.email_domain}" | ||
72 | - recipients user_email | ||
73 | - from "#{user.environment.name} <#{user.environment.noreply_email}>" | ||
74 | - subject _("[%{environment}] Welcome to %{environment} mail!") % { :environment => user.environment.name } | ||
75 | - body :name => user.name, | ||
76 | - :email => user_email, | ||
77 | - :webmail => MailConf.webmail_url(user.login, user.email_domain), | ||
78 | - :environment => user.environment.name, | ||
79 | - :url => url_for(:host => user.environment.default_hostname, :controller => 'home') | ||
80 | - end | ||
81 | - | ||
82 | - def activation_code(user) | ||
83 | - recipients user.email | ||
84 | - | ||
85 | - from "#{user.environment.name} <#{user.environment.noreply_email}>" | ||
86 | - subject _("[%s] Activate your account") % [user.environment.name] | ||
87 | - body :recipient => user.name, | ||
88 | - :activation_code => user.activation_code, | ||
89 | - :environment => user.environment.name, | ||
90 | - :url => user.environment.top_url, | ||
91 | - :redirection => (true if user.return_to), | ||
92 | - :join => (user.community_to_join if user.community_to_join) | ||
93 | - end | ||
94 | - | ||
95 | - def signup_welcome_email(user) | ||
96 | - email_body = user.environment.signup_welcome_text_body.gsub('{user_name}', user.name) | ||
97 | - email_subject = user.environment.signup_welcome_text_subject | ||
98 | - | ||
99 | - content_type 'text/html' | ||
100 | - recipients user.email | ||
101 | - | ||
102 | - from "#{user.environment.name} <#{user.environment.noreply_email}>" | ||
103 | - subject email_subject.blank? ? _("Welcome to environment %s") % [user.environment.name] : email_subject | ||
104 | - body email_body | ||
105 | - end | ||
106 | - end | ||
107 | - | ||
108 | def signup! | 69 | def signup! |
109 | User.transaction do | 70 | User.transaction do |
110 | self.save! | 71 | self.save! |
app/views/user/mailer/activation_email_notify.html.erb
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -<%= _('Hello %s,') % @name %> | ||
2 | - | ||
3 | -<%= _('Your email %s was just activated.') % [@email] %> | ||
4 | - | ||
5 | -<%= _('You can access your e-mail from anywhere, using the following address:') %> | ||
6 | -<%= @webmail %> | ||
7 | - | ||
8 | -<%= _('Greetings,') %> | ||
9 | - | ||
10 | --- | ||
11 | -<%= _('%s team.') % @environment %> | ||
12 | -<%= @url %> |
app/views/user/mailer/signup_welcome_email.html.erb
@@ -0,0 +1,9 @@ | @@ -0,0 +1,9 @@ | ||
1 | +<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %> | ||
2 | + | ||
3 | +<%= word_wrap(_('Welcome to %{environment}! To activate your account, follow the link: %{activation_url}') % { :environment => @environment, :activation_url => @url + url_for(:controller => :account, :action => :activate, :activation_code => @activation_code, :redirection => @redirection, :join => @join) }) %> | ||
4 | + | ||
5 | +<%= _("Greetings,") %> | ||
6 | + | ||
7 | +-- | ||
8 | +<%= _('%s team.') % @environment %> | ||
9 | +<%= url_for @url %> |
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +<%= _('Hello %s,') % @name %> | ||
2 | + | ||
3 | +<%= _('Your email %s was just activated.') % [@email] %> | ||
4 | + | ||
5 | +<%= _('You can access your e-mail from anywhere, using the following address:') %> | ||
6 | +<%= @webmail %> | ||
7 | + | ||
8 | +<%= _('Greetings,') %> | ||
9 | + | ||
10 | +-- | ||
11 | +<%= _('%s team.') % @environment %> | ||
12 | +<%= @url %> |