awesomemailer 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +7 -0
- data/README.md +44 -44
- data/VERSION +1 -1
- data/awesomemailer.gemspec +4 -2
- data/lib/awesome_mailer/base.rb +2 -2
- data/lib/awesomemailer.rb +1 -0
- metadata +10 -6
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -26,8 +26,13 @@ GEM
|
|
26
26
|
addressable
|
27
27
|
erubis (2.6.6)
|
28
28
|
abstract (>= 1.0.0)
|
29
|
+
git (1.2.5)
|
29
30
|
hpricot (0.8.5)
|
30
31
|
i18n (0.4.2)
|
32
|
+
jeweler (1.6.4)
|
33
|
+
bundler (~> 1.0)
|
34
|
+
git (>= 1.2.5)
|
35
|
+
rake
|
31
36
|
mail (2.2.19)
|
32
37
|
activesupport (>= 2.3.6)
|
33
38
|
i18n (>= 0.4.0)
|
@@ -40,6 +45,7 @@ GEM
|
|
40
45
|
rack (>= 1.0.0)
|
41
46
|
rack-test (0.5.7)
|
42
47
|
rack (>= 1.0)
|
48
|
+
rake (0.9.2.2)
|
43
49
|
treetop (1.4.10)
|
44
50
|
polyglot
|
45
51
|
polyglot (>= 0.3.1)
|
@@ -52,3 +58,4 @@ DEPENDENCIES
|
|
52
58
|
actionmailer (>= 3.0)
|
53
59
|
css_parser (>= 1.2.5)
|
54
60
|
hpricot (>= 0.8)
|
61
|
+
jeweler
|
data/README.md
CHANGED
@@ -6,11 +6,11 @@ AwesomeMailer is an ActionMailer extension that supports rad stuff like inline C
|
|
6
6
|
|
7
7
|
Add this to your Gemfile:
|
8
8
|
|
9
|
-
gem '
|
9
|
+
gem 'awesomemailer'
|
10
10
|
|
11
11
|
Or if you're old-fashioned, do this:
|
12
12
|
|
13
|
-
gem install
|
13
|
+
gem install awesomemailer
|
14
14
|
|
15
15
|
Then `require 'awesome_mailer'` and follow the example below.
|
16
16
|
|
@@ -18,56 +18,56 @@ Then `require 'awesome_mailer'` and follow the example below.
|
|
18
18
|
|
19
19
|
Suppose you have the following mailer:
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
class UserMailer < ActionMailer::Base
|
22
|
+
def signup(user_id)
|
23
|
+
@user = User.find(user_id)
|
24
|
+
mail(:to => @user.email, :from => "no-reply@example.com")
|
25
|
+
end
|
26
26
|
end
|
27
27
|
|
28
28
|
... and you have a template `app/views/user_mailer/signup.html.erb`. It might look something like this:
|
29
29
|
|
30
30
|
<html>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
31
|
+
<%= stylesheet_link_tag 'email' %>
|
32
|
+
<body>
|
33
|
+
<div id="header"><%= link_to raw(image_tag('logo.png')), root_url %></div>
|
34
|
+
<div id="content">
|
35
|
+
<p>Welcome to AwesomeMailer, <%= @user.name %>! We think you might be neat.</p>
|
36
|
+
</div>
|
37
|
+
<div id="footer">
|
38
|
+
Copyright © 2012 <a href="http://www.delightfulwidgets.com">Delightful Widgets</a>
|
39
|
+
</div>
|
40
|
+
</body>
|
41
41
|
</html>
|
42
42
|
|
43
43
|
... and your spreadsheet (email.css) might be kinda like this:
|
44
44
|
|
45
45
|
body {
|
46
|
-
|
47
|
-
|
46
|
+
background: #f0f0f0;
|
47
|
+
font: 12pt Arial normal;
|
48
48
|
}
|
49
49
|
|
50
50
|
a img {
|
51
|
-
|
51
|
+
border-width: 0;
|
52
52
|
}
|
53
|
-
|
53
|
+
|
54
54
|
#header {
|
55
|
-
|
56
|
-
|
55
|
+
border-bottom: 1px solid black;
|
56
|
+
margin-bottom: 1em;
|
57
57
|
}
|
58
|
-
|
58
|
+
|
59
59
|
#content {
|
60
|
-
|
61
|
-
|
60
|
+
font-family: Helvetica;
|
61
|
+
padding: 1em 0;
|
62
62
|
}
|
63
|
-
|
63
|
+
|
64
64
|
#content p {
|
65
|
-
|
65
|
+
line-height: 1.3em;
|
66
66
|
}
|
67
|
-
|
67
|
+
|
68
68
|
#footer {
|
69
|
-
|
70
|
-
|
69
|
+
border-top: 1px dotted orange;
|
70
|
+
font-size: 10pt;
|
71
71
|
}
|
72
72
|
|
73
73
|
... you might be unhappy because most mail viewers couldn't care less that you included a stylesheet. But wait!
|
@@ -78,19 +78,19 @@ There's ActionMailer! Just change your mailer to look like this:
|
|
78
78
|
... and voila! Now your templates will render like this:
|
79
79
|
|
80
80
|
<html>
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
81
|
+
<body style="background: #f0f0f0; font: 12pt Arial normal;">
|
82
|
+
<div id="header" style="border-bottom: 1px solid black; margin-bottom: 1em;">
|
83
|
+
<a href="http://www.delightfulwidgets.com/">
|
84
|
+
<img src="http://www.delightfulwidgets.com/assets/logo.png" style="border-width: 0;" />
|
85
|
+
</a>
|
86
|
+
</div>
|
87
|
+
<div id="content" style="font-family: Helvetica; padding: 1em 0;">
|
88
|
+
<p style="line-height: 1.3em;">Welcome to AwesomeMailer, <%= @user.name %>! We think you might be neat.</p>
|
89
|
+
</div>
|
90
|
+
<div id="footer" style="border-top: 1px dotted orange; font-size: 10pt;">
|
91
|
+
Copyright © 2012 <a href="http://www.delightfulwidgets.com">Delightful Widgets</a>
|
92
|
+
</div>
|
93
|
+
</body>
|
94
94
|
</html>
|
95
95
|
|
96
96
|
WOW!
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/awesomemailer.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "awesomemailer"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Flip Sasser"]
|
12
|
-
s.date = "2012-01-
|
12
|
+
s.date = "2012-01-06"
|
13
13
|
s.description = "\n AwesomeMailer embeds your e-mail CSS inline, allowing you to write e-mail templates without worrying too much about stylesheets\n "
|
14
14
|
s.email = "flip@x451.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -23,8 +23,10 @@ Gem::Specification.new do |s|
|
|
23
23
|
"Rakefile",
|
24
24
|
"VERSION",
|
25
25
|
"autotest/discover.rb",
|
26
|
+
"awesomemailer.gemspec",
|
26
27
|
"lib/awesome_mailer.rb",
|
27
28
|
"lib/awesome_mailer/base.rb",
|
29
|
+
"lib/awesomemailer.rb",
|
28
30
|
"spec/lib/awesome_mailer_spec.rb",
|
29
31
|
"spec/spec.opts",
|
30
32
|
"spec/spec_helper.rb",
|
data/lib/awesome_mailer/base.rb
CHANGED
@@ -48,8 +48,8 @@ module AwesomeMailer
|
|
48
48
|
new_url_command = url_command.gsub(item, item_url.to_s)
|
49
49
|
declarations[url_command] = new_url_command
|
50
50
|
end
|
51
|
-
else
|
52
|
-
|
51
|
+
# else
|
52
|
+
# declarations.reject {|item| item.match(/url\s*\(/) }
|
53
53
|
end
|
54
54
|
if selector =~ /(^@)/
|
55
55
|
append_styles!(document, selector, declarations.to_s) if url
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'awesome_mailer'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesomemailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: css_parser
|
16
|
-
requirement: &
|
16
|
+
requirement: &70365360837720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.2.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70365360837720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hpricot
|
27
|
-
requirement: &
|
27
|
+
requirement: &70365360837160 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0.8'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70365360837160
|
36
36
|
description: ! "\n AwesomeMailer embeds your e-mail CSS inline, allowing you
|
37
37
|
to write e-mail templates without worrying too much about stylesheets\n "
|
38
38
|
email: flip@x451.com
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- awesomemailer.gemspec
|
52
52
|
- lib/awesome_mailer.rb
|
53
53
|
- lib/awesome_mailer/base.rb
|
54
|
+
- lib/awesomemailer.rb
|
54
55
|
- spec/lib/awesome_mailer_spec.rb
|
55
56
|
- spec/spec.opts
|
56
57
|
- spec/spec_helper.rb
|
@@ -68,6 +69,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
69
|
- - ! '>='
|
69
70
|
- !ruby/object:Gem::Version
|
70
71
|
version: '0'
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
hash: 1107814900927690412
|
71
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
76
|
none: false
|
73
77
|
requirements:
|