Step validated HTML email and rodie gem

James Peret 10 anni fa
parent
commit
f7899ae132

+ 2 - 1
Gemfile

@@ -52,7 +52,6 @@ gem 'bootstrap_form'
52 52
 gem 'friendly_id', '~> 5.0.0'
53 53
 gem 'devise'
54 54
 gem "devise-async"
55
-gem "letter_opener", :group => :development
56 55
 gem 'redcarpet'
57 56
 gem 'summernote-rails'
58 57
 gem 'figaro'
@@ -70,9 +69,11 @@ gem 'mixpanel-ruby'
70 69
 gem 'valid_email', :require => 'valid_email/email_validator'
71 70
 gem 'hirb'
72 71
 gem 'wirble'
72
+gem 'roadie-rails'
73 73
 
74 74
 group :development do
75 75
   gem "rename"
76
+  gem "letter_opener", '~> 1.3.0'
76 77
 end
77 78
 
78 79
 group :test do

+ 11 - 2
Gemfile.lock

@@ -54,6 +54,8 @@ GEM
54 54
       execjs
55 55
     coffee-script-source (1.8.0)
56 56
     commonjs (0.2.7)
57
+    css_parser (1.3.6)
58
+      addressable
57 59
     cucumber (1.3.17)
58 60
       builder (>= 2.1.2)
59 61
       diff-lcs (>= 1.1.3)
@@ -151,7 +153,7 @@ GEM
151 153
     less-rails (2.5.0)
152 154
       actionpack (>= 3.1)
153 155
       less (~> 2.5.0)
154
-    letter_opener (1.2.0)
156
+    letter_opener (1.3.0)
155 157
       launchy (~> 2.2)
156 158
     libv8 (3.16.14.3)
157 159
     mail (2.5.4)
@@ -218,6 +220,12 @@ GEM
218 220
       sinatra (>= 0.9.2)
219 221
       vegas (~> 0.1.2)
220 222
     rmagick (2.13.4)
223
+    roadie (3.0.3)
224
+      css_parser (~> 1.3.4)
225
+      nokogiri (~> 1.6.0)
226
+    roadie-rails (1.0.4)
227
+      rails (>= 3.0, < 4.3)
228
+      roadie (~> 3.0)
221 229
     rspec (3.1.0)
222 230
       rspec-core (~> 3.1.0)
223 231
       rspec-expectations (~> 3.1.0)
@@ -331,7 +339,7 @@ DEPENDENCIES
331 339
   jquery-rails
332 340
   jquery-turbolinks
333 341
   less-rails
334
-  letter_opener
342
+  letter_opener (~> 1.3.0)
335 343
   mini_magick
336 344
   mixpanel-ruby
337 345
   nested_form
@@ -344,6 +352,7 @@ DEPENDENCIES
344 352
   rename
345 353
   resque (~> 1.22.0)
346 354
   rmagick
355
+  roadie-rails
347 356
   rspec
348 357
   rspec-rails
349 358
   sass-rails

+ 6 - 3
app/mailers/mission_mailer.rb

@@ -1,11 +1,14 @@
1 1
 class MissionMailer < ActionMailer::Base
2
-  default from: "contact@avalanche.network"
2
+  
3
+  include Roadie::Rails::Automatic
4
+  
5
+  default from: "mission_control@avalanche.network"
3 6
   
4 7
   def step_validation_notification(step)
5
-    config = Info.first
8
+    @step = step
6 9
     mail :to        => step.mission_agent.user.email,
7 10
          :subject   => "#{t 'step.step_validated'} - #{step.title}",
8
-         :from      => "no-reply@avalanche.network",
11
+         :from      => "mission_control@avalanche.network",
9 12
          :from_name => "Avalanche System"
10 13
   end
11 14
   

+ 251 - 16
app/views/mission_mailer/step_validation_notification.html.erb

@@ -1,17 +1,252 @@
1
-!DOCTYPE html>
2
-<html>
3
-  <head>
4
-    <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
5
-  </head>
6
-  <body>
7
-    <h1>Welcome to example.com, </h1>
8
-    <p>
9
-      You have successfully signed up to example.com,
10
-      your username is: .<br>
11
-    </p>
12
-    <p>
13
-      To login to the site, just follow this link: 
14
-    </p>
15
-    <p>Thanks for joining and have a great day!</p>
16
-  </body>
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
+		
84
+		.cetered { text-align: center; }
85
+		
86
+		#content-main { padding-left: 10px; padding-right: 10px; }
87
+		
88
+		.page-header {
89
+			text-align: left;
90
+			padding-top: 30px;
91
+		}
92
+		
93
+		.page-header small { 
94
+			font-family: Avenir-MediumOblique;
95
+			font-size: 18px;
96
+			color: #1D1D26;
97
+			line-height: 25px;
98
+			font-weight: 300;
99
+			text-transform: uppercase;
100
+		}
101
+		.page-header h2 {
102
+			font-family: Helvetica-LightOblique;
103
+			font-size: 48px;
104
+			color: #1D1D26;
105
+			line-height: 58px;
106
+			font-weight: 300;
107
+			margin-top: 0px;
108
+			margin-bottom: 7px;
109
+		}
110
+		
111
+		.page-header h3 {
112
+			font-family: Helvetica-Light;
113
+			font-size: 28px;
114
+			color: #000000;
115
+			line-height: 38px;
116
+			font-weight: 400;
117
+			margin-top: 0px;
118
+			
119
+		}
120
+		
121
+		.page-header p {
122
+			/* mission description: */
123
+			font-family: Helvetica-Light;
124
+			font-size: 18px;
125
+			color: #1D1D26;
126
+			line-height: 25px;
127
+			margin-top: 0px;
128
+		}
129
+		
130
+		.page-footer {
131
+			text-align: center;
132
+			margin-top: 30px;
133
+			margin-bottom: 25px;
134
+			font-family: Avenir-LightOblique;
135
+			font-size: 14px;
136
+			color: #000000;
137
+			line-height: 19px;
138
+		}
139
+		
140
+		.page-footer a {
141
+			color: #202020;
142
+			text-decoration: none;
143
+		}
144
+		
145
+		hr { border: 1px solid black; margin-bottom: 20px;}
146
+		
147
+		.btn {
148
+			display: inline-block;
149
+			padding: 4px 12px;
150
+			margin-bottom: 0;
151
+			text-align: center;
152
+			vertical-align: middle;
153
+			cursor: pointer;
154
+			background-color: transparent;
155
+			border: 2px solid #202020;
156
+			border-bottom-color: #202020;
157
+			border-radius: 4px;
158
+			text-shadow: none;
159
+			font-family: Avenir-Book;
160
+			font-style: normal;
161
+			color: #333333;
162
+			text-transform: none;
163
+			text-decoration:none;
164
+		}
165
+		.btn-container {
166
+			margin-bottom: 45px;
167
+			margin-top: 35px;
168
+			text-align: center;
169
+		}
170
+		.copyright { padding-top: 15px;}
171
+		
172
+		</style>
173
+		
174
+    </head>
175
+    <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
176
+        	<table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" class="bodyTable">
177
+            	<tr>
178
+                	<td align="center" valign="top" class="bodyCell">
179
+                    	
180
+                      	<!-- BEGIN HEADER // -->
181
+                          <table border="0" cellpadding="0" cellspacing="0" width="100%" id="page-header">
182
+                              <tr>
183
+                                  <td valign="top" class="cetered">
184
+                                  		<img src="http://avalanche2.s3.amazonaws.com/email_files/base/avalanche2_logo.png" style="width:100px; height: 100px;" id="logo" />
185
+                                  </td>
186
+                              </tr>
187
+                          </table>
188
+                          <!-- // END HEADER -->
189
+					
190
+                    </td>
191
+                </tr>
192
+            </table>
193
+            <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" class="bodyTable" id="body-success">
194
+              	<tr>
195
+                  	<td align="center" valign="top" class="bodyCell">
196
+                    	
197
+					  <!-- BEGIN BODY // -->
198
+	                      <table border="0" cellpadding="0" cellspacing="0" class="container" id="page-content">
199
+	                          <tr>
200
+	                              <td valign="top" class="centered" id="content-main">
201
+									<%= content_tag(:div, class: 'page-header') do %>
202
+										<%= content_tag(:small, ((t 'mission.notification')+':').html_safe) %>
203
+										<%= content_tag(:h2) do %>
204
+											<%= "#{t 'mission.step'} #{@step.step.to_s} #{t 'step.validated'}".html_safe %>
205
+										<% end %>
206
+										<hr>
207
+										<%= content_tag(:small, ((t 'mission.step')+':').html_safe) %>
208
+										<%= content_tag(:h3) do %>
209
+											<%= @step.title %>
210
+										<% end %>
211
+										<%= content_tag(:small, ((t 'mission.mission')+':').html_safe) %>
212
+										<%= content_tag(:p, @step.mission_agent.mission.title) %>
213
+									<% end %>
214
+									<%= content_tag(:div, class: 'btn-container') do %>
215
+										<%= link_to((t '@step.view_next_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') %>
216
+									<% end %>
217
+									
218
+	                              </td>
219
+	                          </tr>
220
+	                      </table>
221
+	                      <!-- // END BODY -->
222
+					
223
+                      </td>
224
+                  </tr>
225
+              </table>
226
+              <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" class="bodyTable">
227
+              	<tr>
228
+                  	<td align="center" valign="top" class="bodyCell">
229
+                    	
230
+                        	<!-- BEGIN FOOTER // -->
231
+	                      <table border="0" cellpadding="0" cellspacing="0" class="container" id="page-footer">
232
+	                          <tr>
233
+	                              <td valign="top" class="centered">
234
+								<%= content_tag(:div, class: 'page-footer') do %>
235
+									<%= link_to((t 'agent.dashboard'), url_for(controller: 'agents', action: 'dashboard', only_path: false)) %>
236
+									 | 
237
+									<%= link_to((t 'missions.missions'),  url_for(controller: 'missions', action: 'index', only_path: false)) %>
238
+									 | 
239
+									<%= link_to((t 'agent.account'),  url_for(controller: 'devise/registrations', action: 'edit', only_path: false)) %>
240
+									<br>
241
+									<span class="copyright">&copy; Avalanche Network</span>
242
+								<% end %>
243
+   	                              </td>
244
+   	                          </tr>
245
+   	                      </table>
246
+                         <!-- // END FOOTER -->
247
+					
248
+                      </td>
249
+                  </tr>
250
+              </table>
251
+    </body>
17 252
 </html>

+ 0 - 21
app/views/user_mailer/contact_message.html.erb

@@ -1,24 +1,3 @@
1
-<!-- ***************************************************
2
-********************************************************
3
-
4
-HOW TO USE: Use these code examples as a guideline for formatting your HTML email. You may want to create your own template based on these snippets or just pick and choose the ones that fix your specific rendering issue(s). There are two main areas in the template: 1. The header (head) area of the document. You will find global styles, where indicated, to move inline. 2. The body section contains more specific fixes and guidance to use where needed in your design.
5
-
6
-DO NOT COPY OVER COMMENTS AND INSTRUCTIONS WITH THE CODE to your message or risk spam box banishment :).
7
-
8
-It is important to note that sometimes the styles in the header area should not be or don't need to be brought inline. Those instances will be marked accordingly in the comments.
9
-
10
-********************************************************
11
-**************************************************** -->
12
-
13
-<!-- Using the xHTML doctype is a good practice when sending HTML email. While not the only doctype you can use, it seems to have the least inconsistencies. For more information on which one may work best for you, check out the resources below.
14
-
15
-UPDATED: Now using xHTML strict based on the fact that gmail and hotmail uses it.  Find out more about that, and another great boilerplate, here: http://www.emailology.org/#1
16
-
17
-More info/Reference on doctypes in email:
18
-Campaign Monitor - http://www.campaignmonitor.com/blog/post/3317/correct-doctype-to-use-in-html-email/
19
-Email on Acid - http://www.emailonacid.com/blog/details/C18/doctype_-_the_black_sheep_of_html_email_design
20
--->
21
-
22 1
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
23 2
 
24 3
 <html xmlns="http://www.w3.org/1999/xhtml">

+ 232 - 0
app/views/user_mailer/email_template.html.erb

@@ -0,0 +1,232 @@
1
+<!-- ***************************************************
2
+********************************************************
3
+
4
+HOW TO USE: Use these code examples as a guideline for formatting your HTML email. You may want to create your own template based on these snippets or just pick and choose the ones that fix your specific rendering issue(s). There are two main areas in the template: 1. The header (head) area of the document. You will find global styles, where indicated, to move inline. 2. The body section contains more specific fixes and guidance to use where needed in your design.
5
+
6
+DO NOT COPY OVER COMMENTS AND INSTRUCTIONS WITH THE CODE to your message or risk spam box banishment :).
7
+
8
+It is important to note that sometimes the styles in the header area should not be or don't need to be brought inline. Those instances will be marked accordingly in the comments.
9
+
10
+********************************************************
11
+**************************************************** -->
12
+
13
+<!-- Using the xHTML doctype is a good practice when sending HTML email. While not the only doctype you can use, it seems to have the least inconsistencies. For more information on which one may work best for you, check out the resources below.
14
+
15
+UPDATED: Now using xHTML strict based on the fact that gmail and hotmail uses it.  Find out more about that, and another great boilerplate, here: http://www.emailology.org/#1
16
+
17
+More info/Reference on doctypes in email:
18
+Campaign Monitor - http://www.campaignmonitor.com/blog/post/3317/correct-doctype-to-use-in-html-email/
19
+Email on Acid - http://www.emailonacid.com/blog/details/C18/doctype_-_the_black_sheep_of_html_email_design
20
+-->
21
+
22
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
23
+
24
+<html xmlns="http://www.w3.org/1999/xhtml">
25
+<head>
26
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
27
+	<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
28
+	<title>Your Message Subject or Title</title>
29
+	<style type="text/css">
30
+
31
+		/***********
32
+		Originally based on The MailChimp Reset from Fabio Carneiro, MailChimp User Experience Design
33
+		More info and templates on Github: https://github.com/mailchimp/Email-Blueprints
34
+		http://www.mailchimp.com &amp; http://www.fabio-carneiro.com
35
+
36
+		INLINE: Yes.
37
+		***********/
38
+		/* Client-specific Styles */
39
+		#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
40
+		body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
41
+		/* Prevent Webkit and Windows Mobile platforms from changing default font sizes, while not breaking desktop design. */
42
+		.ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */
43
+		.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Force Hotmail to display normal line spacing.  More on that: http://www.emailonacid.com/forum/viewthread/43/ */
44
+		#backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}
45
+		/* End reset */
46
+
47
+		/* Some sensible defaults for images
48
+		1. "-ms-interpolation-mode: bicubic" works to help ie properly resize images in IE. (if you are resizing them using the width and height attributes)
49
+		2. "border:none" removes border when linking images.
50
+		3. Updated the common Gmail/Hotmail image display fix: Gmail and Hotmail unwantedly adds in an extra space below images when using non IE browsers. You may not always want all of your images to be block elements. Apply the "image_fix" class to any image you need to fix.
51
+
52
+		Bring inline: Yes.
53
+		*/
54
+		img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
55
+		a img {border:none;}
56
+		.image_fix {display:block;}
57
+
58
+		/** Yahoo paragraph fix: removes the proper spacing or the paragraph (p) tag. To correct we set the top/bottom margin to 1em in the head of the document. Simple fix with little effect on other styling. NOTE: It is also common to use two breaks instead of the paragraph tag but I think this way is cleaner and more semantic. NOTE: This example recommends 1em. More info on setting web defaults: http://www.w3.org/TR/CSS21/sample.html or http://meiert.com/en/blog/20070922/user-agent-style-sheets/
59
+
60
+		Bring inline: Yes.
61
+		**/
62
+		p {margin: 1em 0;}
63
+
64
+		/** Hotmail header color reset: Hotmail replaces your header color styles with a green color on H2, H3, H4, H5, and H6 tags. In this example, the color is reset to black for a non-linked header, blue for a linked header, red for an active header (limited support), and purple for a visited header (limited support).  Replace with your choice of color. The !important is really what is overriding Hotmail's styling. Hotmail also sets the H1 and H2 tags to the same size.
65
+
66
+		Bring inline: Yes.
67
+		**/
68
+		h1, h2, h3, h4, h5, h6 {color: black !important;}
69
+
70
+		h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {color: blue !important;}
71
+
72
+		h1 a:active, h2 a:active,  h3 a:active, h4 a:active, h5 a:active, h6 a:active {
73
+			color: red !important; /* Preferably not the same color as the normal header link color.  There is limited support for psuedo classes in email clients, this was added just for good measure. */
74
+		 }
75
+
76
+		h1 a:visited, h2 a:visited,  h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {
77
+			color: purple !important; /* Preferably not the same color as the normal header link color. There is limited support for psuedo classes in email clients, this was added just for good measure. */
78
+		}
79
+
80
+		/** Outlook 07, 10 Padding issue: These "newer" versions of Outlook add some padding around table cells potentially throwing off your perfectly pixeled table.  The issue can cause added space and also throw off borders completely.  Use this fix in your header or inline to safely fix your table woes.
81
+
82
+		More info: http://www.ianhoar.com/2008/04/29/outlook-2007-borders-and-1px-padding-on-table-cells/
83
+		http://www.campaignmonitor.com/blog/post/3392/1px-borders-padding-on-table-cells-in-outlook-07/
84
+
85
+		H/T @edmelly
86
+
87
+		Bring inline: No.
88
+		**/
89
+		table td {border-collapse: collapse;}
90
+
91
+		/** Remove spacing around Outlook 07, 10 tables
92
+
93
+		More info : http://www.campaignmonitor.com/blog/post/3694/removing-spacing-from-around-tables-in-outlook-2007-and-2010/
94
+
95
+		Bring inline: Yes
96
+		**/
97
+		table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
98
+
99
+		/* Styling your links has become much simpler with the new Yahoo.  In fact, it falls in line with the main credo of styling in email, bring your styles inline.  Your link colors will be uniform across clients when brought inline.
100
+
101
+		Bring inline: Yes. */
102
+		a {color: orange;}
103
+
104
+		/* Or to go the gold star route...
105
+		a:link { color: orange; }
106
+		a:visited { color: blue; }
107
+		a:hover { color: green; }
108
+		*/
109
+
110
+		/***************************************************
111
+		****************************************************
112
+		MOBILE TARGETING
113
+
114
+		Use @media queries with care.  You should not bring these styles inline -- so it's recommended to apply them AFTER you bring the other stlying inline.
115
+
116
+		Note: test carefully with Yahoo.
117
+		Note 2: Don't bring anything below this line inline.
118
+		****************************************************
119
+		***************************************************/
120
+
121
+		/* NOTE: To properly use @media queries and play nice with yahoo mail, use attribute selectors in place of class, id declarations.
122
+		table[class=classname]
123
+		Read more: http://www.campaignmonitor.com/blog/post/3457/media-query-issues-in-yahoo-mail-mobile-email/
124
+		*/
125
+		@media only screen and (max-device-width: 480px) {
126
+
127
+			/* A nice and clean way to target phone numbers you want clickable and avoid a mobile phone from linking other numbers that look like, but are not phone numbers.  Use these two blocks of code to "unstyle" any numbers that may be linked.  The second block gives you a class to apply with a span tag to the numbers you would like linked and styled.
128
+
129
+			Inspired by Campaign Monitor's article on using phone numbers in email: http://www.campaignmonitor.com/blog/post/3571/using-phone-numbers-in-html-email/.
130
+
131
+			Step 1 (Step 2: line 224)
132
+			*/
133
+			a[href^="tel"], a[href^="sms"] {
134
+						text-decoration: none;
135
+						color: black; /* or whatever your want */
136
+						pointer-events: none;
137
+						cursor: default;
138
+					}
139
+
140
+			.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
141
+						text-decoration: default;
142
+						color: orange !important; /* or whatever your want */
143
+						pointer-events: auto;
144
+						cursor: default;
145
+					}
146
+		}
147
+
148
+		/* More Specific Targeting */
149
+
150
+		@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
151
+			/* You guessed it, ipad (tablets, smaller screens, etc) */
152
+
153
+			/* Step 1a: Repeating for the iPad */
154
+			a[href^="tel"], a[href^="sms"] {
155
+						text-decoration: none;
156
+						color: blue; /* or whatever your want */
157
+						pointer-events: none;
158
+						cursor: default;
159
+					}
160
+
161
+			.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
162
+						text-decoration: default;
163
+						color: orange !important;
164
+						pointer-events: auto;
165
+						cursor: default;
166
+					}
167
+		}
168
+
169
+		@media only screen and (-webkit-min-device-pixel-ratio: 2) {
170
+			/* Put your iPhone 4g styles in here */
171
+		}
172
+
173
+		/* Following Android targeting from:
174
+		http://developer.android.com/guide/webapps/targeting.html
175
+		http://pugetworks.com/2011/04/css-media-queries-for-targeting-different-mobile-devices/  */
176
+		@media only screen and (-webkit-device-pixel-ratio:.75){
177
+			/* Put CSS for low density (ldpi) Android layouts in here */
178
+		}
179
+		@media only screen and (-webkit-device-pixel-ratio:1){
180
+			/* Put CSS for medium density (mdpi) Android layouts in here */
181
+		}
182
+		@media only screen and (-webkit-device-pixel-ratio:1.5){
183
+			/* Put CSS for high density (hdpi) Android layouts in here */
184
+		}
185
+		/* end Android targeting */
186
+	</style>
187
+
188
+	<!-- Targeting Windows Mobile -->
189
+	<!--[if IEMobile 7]>
190
+	<style type="text/css">
191
+
192
+	</style>
193
+	<![endif]-->
194
+
195
+	<!-- ***********************************************
196
+	****************************************************
197
+	END MOBILE TARGETING
198
+	****************************************************
199
+	************************************************ -->
200
+
201
+	<!--[if gte mso 9]>
202
+	<style>
203
+		/* Target Outlook 2007 and 2010 */
204
+	</style>
205
+	<![endif]-->
206
+</head>
207
+<body>
208
+	<!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. -->
209
+	<table cellpadding="0" cellspacing="0" border="0" id="backgroundTable">
210
+	<tr>
211
+		<td>
212
+
213
+		<!-- Tables are the most common way to format your email consistently. Set your table widths inside cells and in most cases reset cellpadding, cellspacing, and border to zero. Use nested tables as a way to space effectively in your message. -->
214
+		<table cellpadding="0" cellspacing="0" border="0" align="center">
215
+			<tr>
216
+				<td width="200" valign="top"></td>
217
+				<td width="200" valign="top"></td>
218
+				<td width="200" valign="top"></td>
219
+			</tr>
220
+		</table>
221
+
222
+		<!-- End example table -->
223
+
224
+		<p><%= simple_format @msg.content %></p>
225
+		<hr>
226
+		<p><i>Mensagem enviada pelo site <%= @config.website_link != nil ? (link_to @config.website_name, @config.website_link) : @config.website_name  %>.</i></p>
227
+		</td>
228
+	</tr>
229
+	</table>
230
+	<!-- End of wrapper table -->
231
+</body>
232
+</html>

+ 2 - 0
config/application.rb

@@ -12,6 +12,8 @@ module Avalanche2
12 12
     
13 13
     config.autoload_paths += %W(#{config.root}/lib)
14 14
     
15
+    config.action_mailer.default_url_options = { host: "http://www.avalanche.network" }
16
+    config.action_mailer.asset_host = "http://www.avalanche.network"
15 17
     # Settings in config/environments/* take precedence over those specified here.
16 18
     # Application configuration should go into files in config/initializers
17 19
     # -- all .rb files in that directory are automatically loaded.

+ 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: 3000 }
30
+  config.action_mailer.default_url_options = { host: 'localhost', port: 5000 }
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

+ 1 - 1
config/environments/test.rb

@@ -36,6 +36,6 @@ Avalanche2::Application.configure do
36 36
   
37 37
   # Crapy Fix for email testing error
38 38
   config.action_mailer.raise_delivery_errors = true
39
-  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
39
+  config.action_mailer.default_url_options = { :host => 'localhost:5000' }
40 40
   
41 41
 end