Step denied email with HTML and text versions

James Peret 10 jaren geleden
bovenliggende
commit
095ad88fd7

+ 9 - 1
app/mailers/mission_mailer.rb

@@ -9,7 +9,15 @@ class MissionMailer < ActionMailer::Base
9 9
     mail :to        => step.mission_agent.user.email,
10 10
          :subject   => "#{t 'step.step_validated'} - #{step.title}",
11 11
          :from      => "mission_control@avalanche.network",
12
-         :from_name => "Avalanche System"
12
+         :from_name => "Mission Control - Avalanche Network"
13
+  end
14
+  
15
+  def step_denied_notification(step)
16
+    @step = step
17
+    mail :to        => step.mission_agent.user.email,
18
+         :subject   => "#{t 'step.step_denied'} - #{step.title}",
19
+         :from      => "mission_control@avalanche.network",
20
+         :from_name => "Mission Control - Avalanche Network"
13 21
   end
14 22
   
15 23
 end

+ 253 - 0
app/views/mission_mailer/step_denied_notification.html.erb

@@ -0,0 +1,253 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+<html xmlns="http://www.w3.org/1999/xhtml">
3
+	<head>
4
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
+        <title>*|MC:SUBJECT|*</title>
6
+        <style type="text/css" data-roadie-ignore>
7
+			/* ---- CLIENT-SPECIFIC STYLES ---- */
8
+			
9
+			 /* Force Outlook to provide a "view in browser" message */
10
+			#outlook a{padding:0;}
11
+			 /* Force Hotmail to display emails at full width */
12
+			.ReadMsgBody{width:100%;} .ExternalClass{width:100%;}
13
+			/* Force Hotmail to display normal line spacing */
14
+			.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} 
15
+			/* Prevent WebKit and Windows mobile changing default text sizes */
16
+			body, table, td, p, a, li, blockquote{-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;} 
17
+			/* Remove spacing between tables in Outlook 2007 and up */
18
+			table, td{mso-table-lspace:0pt; mso-table-rspace:0pt;} 
19
+			/* Allow smoother rendering of resized image in Internet Explorer */
20
+			img{-ms-interpolation-mode:bicubic;} 
21
+
22
+			/* ---- RESET STYLES ---- */
23
+			body{margin:0; padding:0;}
24
+			img{border:0; height:auto; line-height:100%; outline:none; text-decoration:none;}
25
+			table{border-collapse:collapse !important;}
26
+			body, .bodyTable, .bodyCell{height:100% !important; margin:0; padding:0; width:100% !important;}
27
+			
28
+			/* ---- TEMPLATE STYLES ---- */
29
+			.container, #page-header, #page-content, #page-footer { width: 600px; }
30
+			
31
+			
32
+			
33
+			.page-footer a {
34
+				color: #202020;
35
+				text-decoration: underline;
36
+			}
37
+			.btn:hover { background: rgba(0, 0, 0, 0.2); }
38
+
39
+			/* ---- MOBILE STYLES ---- */
40
+			
41
+			@media only screen and (max-width: 480px){
42
+				
43
+				/* ---- CLIENT-SPECIFIC MOBILE STYLES ---- */
44
+				/* Prevent Webkit platforms from changing default text sizes */
45
+				body, table, td, p, a, li, blockquote{-webkit-text-size-adjust:none !important;} 
46
+				/* Prevent iOS Mail from adding padding to the body */
47
+			    	body{width:100% !important; min-width:100% !important;} 
48
+	
49
+				/* ---- MOBILE RESET STYLES ---- */
50
+				.bodyCell{padding:0px !important;}
51
+
52
+				/* ---- MOBILE STYLES ---- */
53
+		
54
+				@media only screen and (max-width: 480px){
55
+					
56
+					/* ---- MOBILE TEMPLATE STYLES ---- */
57
+					.page-header, #page-header, #page-content, #page-footer { width: 100%; padding-left: 25px; padding-right: 25px; margin-left: 0px; margin-right: 0px;}
58
+					.hide-mobile { display:none !important; }
59
+				}
60
+			}
61
+		</style>
62
+		
63
+		<style>
64
+		
65
+		/* ---- TEMPLATE STYLES ---- */
66
+
67
+		body, .bodyTable{
68
+			/*@editable*/ background-color:#FFFFFF;
69
+			padding: 0px; margin: 0px;
70
+		}
71
+		
72
+		h1 {
73
+			/* mission description 2: */
74
+			font-family: Avenir-Light;
75
+			font-size: 28px;
76
+			color: #000000;
77
+			line-height: 38px;
78
+		}
79
+		
80
+		.bodyTable, .bodyCell { margin: 0px; padding: 0px;}
81
+		
82
+		#body-success { background-color: #92BC64; width: 100%; margin-left: 0px; margin-right: 0px;}
83
+		#body-danger { background-color: #ED5A51; width: 100%; margin-left: 0px; margin-right: 0px;}
84
+		
85
+		.cetered { text-align: center; }
86
+		
87
+		#content-main { padding-left: 10px; padding-right: 10px; }
88
+		
89
+		.page-header {
90
+			text-align: left;
91
+			padding-top: 30px;
92
+		}
93
+		
94
+		.page-header small { 
95
+			font-family: Avenir-MediumOblique;
96
+			font-size: 18px;
97
+			color: #1D1D26;
98
+			line-height: 25px;
99
+			font-weight: 300;
100
+			text-transform: uppercase;
101
+		}
102
+		.page-header h2 {
103
+			font-family: Helvetica-LightOblique;
104
+			font-size: 48px;
105
+			color: #1D1D26;
106
+			line-height: 58px;
107
+			font-weight: 300;
108
+			margin-top: 0px;
109
+			margin-bottom: 7px;
110
+		}
111
+		
112
+		.page-header h3 {
113
+			font-family: Helvetica-Light;
114
+			font-size: 28px;
115
+			color: #000000;
116
+			line-height: 38px;
117
+			font-weight: 400;
118
+			margin-top: 0px;
119
+			
120
+		}
121
+		
122
+		.page-header p {
123
+			/* mission description: */
124
+			font-family: Helvetica-Light;
125
+			font-size: 18px;
126
+			color: #1D1D26;
127
+			line-height: 25px;
128
+			margin-top: 0px;
129
+		}
130
+		
131
+		.page-footer {
132
+			text-align: center;
133
+			margin-top: 30px;
134
+			margin-bottom: 25px;
135
+			font-family: Avenir-LightOblique;
136
+			font-size: 14px;
137
+			color: #000000;
138
+			line-height: 19px;
139
+		}
140
+		
141
+		.page-footer a {
142
+			color: #202020;
143
+			text-decoration: none;
144
+		}
145
+		
146
+		hr { border: 1px solid black; margin-bottom: 20px;}
147
+		
148
+		.btn {
149
+			display: inline-block;
150
+			padding: 4px 12px;
151
+			margin-bottom: 0;
152
+			text-align: center;
153
+			vertical-align: middle;
154
+			cursor: pointer;
155
+			background-color: transparent;
156
+			border: 2px solid #202020;
157
+			border-bottom-color: #202020;
158
+			border-radius: 4px;
159
+			text-shadow: none;
160
+			font-family: Avenir-Book;
161
+			font-style: normal;
162
+			color: #333333;
163
+			text-transform: none;
164
+			text-decoration:none;
165
+		}
166
+		.btn-container {
167
+			margin-bottom: 45px;
168
+			margin-top: 35px;
169
+			text-align: center;
170
+		}
171
+		.copyright { padding-top: 15px;}
172
+		
173
+		</style>
174
+		
175
+    </head>
176
+    <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
177
+        	<table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" class="bodyTable">
178
+            	<tr>
179
+                	<td align="center" valign="top" class="bodyCell">
180
+                    	
181
+                      	<!-- BEGIN HEADER // -->
182
+                          <table border="0" cellpadding="0" cellspacing="0" width="100%" id="page-header">
183
+                              <tr>
184
+                                  <td valign="top" class="cetered">
185
+                                  		<img src="http://avalanche2.s3.amazonaws.com/email_files/base/avalanche2_logo.png" style="width:100px; height: 100px;" id="logo" />
186
+                                  </td>
187
+                              </tr>
188
+                          </table>
189
+                          <!-- // END HEADER -->
190
+					
191
+                    </td>
192
+                </tr>
193
+            </table>
194
+            <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" class="bodyTable" id="body-danger">
195
+              	<tr>
196
+                  	<td align="center" valign="top" class="bodyCell">
197
+                    	
198
+					  <!-- BEGIN BODY // -->
199
+	                      <table border="0" cellpadding="0" cellspacing="0" class="container" id="page-content">
200
+	                          <tr>
201
+	                              <td valign="top" class="centered" id="content-main">
202
+									<%= content_tag(:div, class: 'page-header') do %>
203
+										<%= content_tag(:small, ((t 'mission.notification')+':').html_safe) %>
204
+										<%= content_tag(:h2) do %>
205
+											<%= "#{t 'mission.step'} #{@step.step.to_s} #{t 'step.denied'}".html_safe %>
206
+										<% end %>
207
+										<hr>
208
+										<%= content_tag(:small, ((t 'mission.step')+':').html_safe) %>
209
+										<%= content_tag(:h3) do %>
210
+											<%= @step.title %>
211
+										<% end %>
212
+										<%= content_tag(:small, ((t 'mission.mission')+':').html_safe) %>
213
+										<%= content_tag(:p, @step.mission_agent.mission.title) %>
214
+									<% end %>
215
+									<%= content_tag(:div, class: 'btn-container') do %>
216
+										<%= link_to((t 'step.review_step'), url_for(controller: 'missions', action: 'show_agent_details', id: @step.mission_agent.mission.slug, agent: @step.mission_agent.slug, only_path: false), class: 'btn') %>
217
+									<% end %>
218
+									
219
+	                              </td>
220
+	                          </tr>
221
+	                      </table>
222
+	                      <!-- // END BODY -->
223
+					
224
+                      </td>
225
+                  </tr>
226
+              </table>
227
+              <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" class="bodyTable">
228
+              	<tr>
229
+                  	<td align="center" valign="top" class="bodyCell">
230
+                    	
231
+                        	<!-- BEGIN FOOTER // -->
232
+	                      <table border="0" cellpadding="0" cellspacing="0" class="container" id="page-footer">
233
+	                          <tr>
234
+	                              <td valign="top" class="centered">
235
+								<%= content_tag(:div, class: 'page-footer') do %>
236
+									<%= link_to((t 'agent.dashboard'), url_for(controller: 'agents', action: 'dashboard', only_path: false)) %>
237
+									 | 
238
+									<%= link_to((t 'missions.missions'),  url_for(controller: 'missions', action: 'index', only_path: false)) %>
239
+									 | 
240
+									<%= link_to((t 'agent.account'),  url_for(controller: 'devise/registrations', action: 'edit', only_path: false)) %>
241
+									<br>
242
+									<span class="copyright">&copy; Avalanche Network</span>
243
+								<% end %>
244
+   	                              </td>
245
+   	                          </tr>
246
+   	                      </table>
247
+                         <!-- // END FOOTER -->
248
+					
249
+                      </td>
250
+                  </tr>
251
+              </table>
252
+    </body>
253
+</html>

+ 12 - 0
app/views/mission_mailer/step_denied_notification.text.erb

@@ -0,0 +1,12 @@
1
+-----------------
2
+
3
+<%= "#{t 'mission.step'} #{@step.step.to_s} #{t 'step.denied'} - #{@step.title}" %>
4
+
5
+<%= "#{t 'mission.mission'}:" %>
6
+<%= @step.mission_agent.mission.title %>
7
+
8
+<%= "#{t 'step.review_step'}:" %>
9
+<%= url_for(controller: 'missions', action: 'show_agent_details', id: @step.mission_agent.mission.slug, agent: @step.mission_agent.slug, only_path: false) %>
10
+
11
+-----------------
12
+Avalanche Mission Control

+ 12 - 9
app/views/mission_mailer/step_validation_notification.text.erb

@@ -1,9 +1,12 @@
1
-Welcome to example.com, 
2
-===============================================
3
- 
4
-You have successfully signed up to example.com,
5
-your username is: 
6
- 
7
-To login to the site, just follow this link:
8
- 
9
-Thanks for joining and have a great day!
1
+-----------------
2
+
3
+<%= "#{t 'mission.step'} #{@step.step.to_s} #{t 'step.validated'} - #{@step.title}" %>
4
+
5
+<%= "#{t 'mission.mission'}:" %>
6
+<%= @step.mission_agent.mission.title %>
7
+
8
+<%= "#{t 'step.view_next_step'}:" %>
9
+<%= url_for(controller: 'missions', action: 'show_agent_details', id: @step.mission_agent.mission.slug, agent: @step.mission_agent.slug, only_path: false) %>
10
+
11
+-----------------
12
+Avalanche Mission Control

+ 13 - 13
config/environments/development.rb

@@ -27,20 +27,20 @@ Avalanche2::Application.configure do
27 27
   # number of complex assets.
28 28
   config.assets.debug = true
29 29
   
30
-  config.action_mailer.default_url_options = { host: 'localhost', port: 5000 }
30
+  config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
31 31
   config.action_mailer.raise_delivery_errors = true
32 32
   
33
-  #config.action_mailer.delivery_method = :letter_opener
34
-  config.action_mailer.delivery_method = :smtp
35
-
36
-  config.action_mailer.smtp_settings = {
37
-      :address   => "smtp.mandrillapp.com",
38
-      :port      => 587, # ports 587 and 2525 are also supported with STARTTLS
39
-      :enable_starttls_auto => true, # detects and uses STARTTLS
40
-      :user_name => ENV["MANDRILL_USERNAME"],
41
-      :password  => ENV["MANDRILL_KEY"], # SMTP password is any valid API key
42
-      :authentication => 'login', # Mandrill supports 'plain' or 'login'
43
-      :domain => ENV["DOMAIN_NAME"] # your domain to identify your server when connecting
44
-  }
33
+  config.action_mailer.delivery_method = :letter_opener
34
+  #config.action_mailer.delivery_method = :smtp
35
+  
36
+  # config.action_mailer.smtp_settings = {
37
+  #     :address   => "smtp.mandrillapp.com",
38
+  #     :port      => 587, # ports 587 and 2525 are also supported with STARTTLS
39
+  #     :enable_starttls_auto => true, # detects and uses STARTTLS
40
+  #     :user_name => ENV["MANDRILL_USERNAME"],
41
+  #     :password  => ENV["MANDRILL_KEY"], # SMTP password is any valid API key
42
+  #     :authentication => 'login', # Mandrill supports 'plain' or 'login'
43
+  #     :domain => ENV["DOMAIN_NAME"] # your domain to identify your server when connecting
44
+  # }
45 45
   
46 46
 end

config/locales/landing_page.pt_BR.yml → config/locales/landing_page.pt-BR.yml


+ 16 - 0
config/locales/mission.en.yml

@@ -0,0 +1,16 @@
1
+en:
2
+  mission:
3
+    mission: 'Mission'
4
+    missions: 'Missions'
5
+    notification: 'Notification'
6
+    step: 'Step'
7
+  step:
8
+    validated: 'Validated'
9
+    step_validated: 'Step validated'
10
+    denied: 'Denied'
11
+    step_denied: 'Step denied'
12
+    view_next_step: 'View Next Step'
13
+    review_step: 'Review Step'
14
+  agent:
15
+    dashboard: 'Dashboard'
16
+    account: 'Account'

+ 16 - 0
config/locales/mission.pt-BR.yml

@@ -0,0 +1,16 @@
1
+pt-Br:
2
+  mission:
3
+    mission: 'Missão'
4
+    missions: 'Missões'
5
+    notification: 'Notificação'
6
+    step: 'Passo'
7
+  step:
8
+    validated: 'Validado'
9
+    step_validated: 'Passo validado'
10
+    denied: 'Negado'
11
+    step_denied: 'Passo negado'
12
+    view_next_step: 'Ver Proximo Passo'
13
+    review_step: 'Revisar Passo'
14
+  agent:
15
+    dashboard: 'Painel'
16
+    account: 'Conta'