Permalink
Browse files

* Updated `emails#show` to conditionally ensure the link to plain tex…

…t email displays when using rails_email_preview in conjunction with premailer-rails3.

* Updated readme to reflect these changes.
  • Loading branch information...
coryschires committed Apr 26, 2012
1 parent f4f6614 commit df5fdef28387cc876661d412c1be289df44d7082
Showing with 5 additions and 5 deletions.
  1. +4 −4 README.md
  2. +1 −1 app/views/rails_email_preview/emails/show.html.haml
View
@@ -73,17 +73,17 @@ To get the url of RailsEmailPreview in your main app you can call rails_email_pr
Premailer integration
---------------------
-[Premailer](https://github.com/alexdunae/premailer) (CSS inlining) integration can be done by using the <code>before_render</code> hook:
+[Premailer](https://github.com/alexdunae/premailer) automatically translates standard CSS rules into old-school inline styles. It will also automatically create plain text emails based on their HTML counterparts. If you're your running Rails 3, I suggest using [premailer-rails3](https://github.com/fphilipe/premailer-rails3) as it requires almost no configuration.
-For example, to process the previews with [ActionMailer Inline CSS](https://github.com/ndbroadbent/actionmailer_inline_css)
-can be done like so:
+Integration can be done by using the <code>before_render</code> hook:
RailsEmailPreview.setup do |config|
config.before_render do |message|
- ActionMailer::InlineCssHook.delivering_email(message)
+ PremailerRails::Hook.delivering_email(message)
end
end
+
Interface
---------
@@ -4,7 +4,7 @@
html_url = if @mail.multipart? || @mail.content_type =~ %r(text/html)
rails_email_preview.email_url(params.merge(:part_type => 'text/html'))
end
- plain_url = if @mail.multipart? || @mail.content_type =~ %r(text/plain)
+ plain_url = if @mail.multipart? || @mail.content_type =~ %r(text/plain) || Object.const_defined?('PremailerRails')
rails_email_preview.email_url(params.merge(:part_type => 'text/plain'))
end

0 comments on commit df5fdef

Please sign in to comment.