Commit d59c7bb778349328268a59e8c563213e6282ba91
1 parent
9b9fba4e
Exists in
master
and in
1 other branch
Replaced premailer initializer with my actionmailer_inline_css gem.
Showing
4 changed files
with
7 additions
and
21 deletions
Show diff stats
Gemfile
| @@ -16,7 +16,7 @@ gem 'octokit' | @@ -16,7 +16,7 @@ gem 'octokit' | ||
| 16 | gem 'inherited_resources' | 16 | gem 'inherited_resources' |
| 17 | gem 'SystemTimer', :platform => :ruby_18 | 17 | gem 'SystemTimer', :platform => :ruby_18 |
| 18 | gem 'hoptoad_notifier', "~> 2.4" | 18 | gem 'hoptoad_notifier', "~> 2.4" |
| 19 | -gem 'premailer' | 19 | +gem 'actionmailer_inline_css', ">= 1.0.0" |
| 20 | 20 | ||
| 21 | platform :ruby do | 21 | platform :ruby do |
| 22 | gem 'bson_ext', '~> 1.3.1' | 22 | gem 'bson_ext', '~> 1.3.1' |
Gemfile.lock
| @@ -13,6 +13,10 @@ GEM | @@ -13,6 +13,10 @@ GEM | ||
| 13 | actionmailer (3.0.5) | 13 | actionmailer (3.0.5) |
| 14 | actionpack (= 3.0.5) | 14 | actionpack (= 3.0.5) |
| 15 | mail (~> 2.2.15) | 15 | mail (~> 2.2.15) |
| 16 | + actionmailer_inline_css (1.0.0) | ||
| 17 | + actionmailer (>= 3.0.0) | ||
| 18 | + nokogiri (>= 1.4.4) | ||
| 19 | + premailer (>= 1.7.1) | ||
| 16 | actionpack (3.0.5) | 20 | actionpack (3.0.5) |
| 17 | activemodel (= 3.0.5) | 21 | activemodel (= 3.0.5) |
| 18 | activesupport (= 3.0.5) | 22 | activesupport (= 3.0.5) |
| @@ -206,6 +210,7 @@ PLATFORMS | @@ -206,6 +210,7 @@ PLATFORMS | ||
| 206 | 210 | ||
| 207 | DEPENDENCIES | 211 | DEPENDENCIES |
| 208 | SystemTimer | 212 | SystemTimer |
| 213 | + actionmailer_inline_css (>= 1.0.0) | ||
| 209 | bson_ext (~> 1.3.1) | 214 | bson_ext (~> 1.3.1) |
| 210 | database_cleaner (~> 0.6.0) | 215 | database_cleaner (~> 0.6.0) |
| 211 | devise (~> 1.4.0) | 216 | devise (~> 1.4.0) |
| @@ -220,7 +225,6 @@ DEPENDENCIES | @@ -220,7 +225,6 @@ DEPENDENCIES | ||
| 220 | nokogiri | 225 | nokogiri |
| 221 | octokit | 226 | octokit |
| 222 | pivotal-tracker | 227 | pivotal-tracker |
| 223 | - premailer | ||
| 224 | rails (= 3.0.5) | 228 | rails (= 3.0.5) |
| 225 | redmine_client! | 229 | redmine_client! |
| 226 | rspec (~> 2.5) | 230 | rspec (~> 2.5) |
app/views/layouts/mailer.html.haml
| 1 | %html | 1 | %html |
| 2 | %head | 2 | %head |
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | 3 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 4 | - | 4 | + = embedded_style_tag |
| 5 | %body(leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0") | 5 | %body(leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0") |
| 6 | %center | 6 | %center |
| 7 | %table(cellpadding="0" cellspacing="0" border="0" width="100%") | 7 | %table(cellpadding="0" cellspacing="0" border="0" width="100%") |
config/initializers/actionmailer_inline_css.rb
| @@ -1,18 +0,0 @@ | @@ -1,18 +0,0 @@ | ||
| 1 | -# | ||
| 2 | -# ActionMailer module for inline css in html emails | ||
| 3 | -# | ||
| 4 | -module ActionMailer::InlineCss | ||
| 5 | - def render(*args) | ||
| 6 | - if (template = args.first[:template]) && template.mime_type.html? | ||
| 7 | - premailer = Premailer.new(super, :with_html_string => true, | ||
| 8 | - :css => default_params[:css] || | ||
| 9 | - ["#{Rails.root}/public/stylesheets/mailers/#{mailer_name}.css"]) | ||
| 10 | - premailer.to_inline_css | ||
| 11 | - else | ||
| 12 | - super | ||
| 13 | - end | ||
| 14 | - end | ||
| 15 | -end | ||
| 16 | - | ||
| 17 | -ActionMailer::Base.send :include, ActionMailer::InlineCss | ||
| 18 | - |