Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7534 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] ActionMailer : Allow templating engines to hook into multipart email

Reported by: cwd Assigned to: bitsweat
Priority: normal Milestone: 1.2.4
Component: ActionMailer Version: edge
Severity: normal Keywords: verified
Cc: minam

Description

Currently, only rhtml and rxml extensions are recognized for templates that imply a type. E.g.,

ticket_create.text.plain.rhtml

This set of patches creates one class-level method:

ActionMailer::Base.register_template_extension(extension)

This can be called by the plugin implementing the templating language (Haml, Markaby, etc.), or it can be explicitly specified by the user by calling it in environment.rb.

The reason for the function it to decrease the likelihood of someone writing code like:

ActionMailer::Base.template_extensions =

and then wondering why their templates don't parse.

Attachments

lib_action_mailer_base_rb.diff (1.8 kB) - added by cwd on 02/12/07 04:17:53.
Patch to ActionMailer base.rb
custom_templating_extension.text.plain.haml (54 bytes) - added by cwd on 02/12/07 04:20:00.
Fixture for new test (put in test/fixtures/templates)
test_mail_service_test_rb.diff (2.1 kB) - added by cwd on 02/12/07 19:24:23.
test_mail_service_test_rb.diff
custom_templating_extension.text.html.haml (54 bytes) - added by cwd on 02/12/07 19:25:17.
text/html version
allow_templating_engines_to_hook_into_multipart_email.diff (4.8 kB) - added by josh on 02/24/07 17:28:34.
Tidied up patch against r6216.

Change History

02/12/07 04:17:53 changed by cwd

  • attachment lib_action_mailer_base_rb.diff added.

Patch to ActionMailer base.rb

02/12/07 04:20:00 changed by cwd

  • attachment custom_templating_extension.text.plain.haml added.

Fixture for new test (put in test/fixtures/templates)

(in reply to: ↑ description ) 02/12/07 18:19:56 changed by hcatlin

+1

Haml totally needs this!

Great work sross!

Just a note too. He used a .haml extension test file, but the Haml::Engine is not used to render. Its just a stub.

02/12/07 19:24:23 changed by cwd

  • attachment test_mail_service_test_rb.diff added.

test_mail_service_test_rb.diff

02/12/07 19:25:17 changed by cwd

  • attachment custom_templating_extension.text.html.haml added.

text/html version

02/12/07 19:27:07 changed by cwd

I just changed the test to beef it up a bit. Additionally, a correction:

The two templates must go in the test/fixtures/test_mailer directory.

02/12/07 19:48:20 changed by codahale

+1 for sure, no reason to keep AM tied down

(in reply to: ↑ description ) 02/12/07 20:12:02 changed by leftist

+1 - I would love to Haml-ize my type-specific AM templates.

02/15/07 03:52:39 changed by minam

  • status changed from new to closed.
  • resolution set to fixed.

Committed in [6146]. Thanks for the patch! (For future reference, please submit patches as a single file, instead of multiples; it makes them much easier to review and apply.)

02/15/07 05:20:34 changed by bitsweat

  • cc set to minam.
  • status changed from closed to reopened.
  • resolution deleted.

I don't see the changeset. [6146] is scriptaculous stuff.

02/15/07 14:25:05 changed by minam

Well, crap. I'm major confused then. Did the URL for the RAILS svn repo change without me knowing? I've committed it to http://dev.rubyonrails.com/svn/rails/trunk/actionmailer.

02/15/07 15:13:46 changed by obrie

02/24/07 17:28:15 changed by josh

  • keywords set to verified.
  • milestone changed from 1.x to 1.2.

02/24/07 17:28:34 changed by josh

  • attachment allow_templating_engines_to_hook_into_multipart_email.diff added.

Tidied up patch against r6216.

03/16/07 20:47:21 changed by cwd

I see this is patch is not in trunk as of right now. Is there a blocking issue?

06/07/07 22:55:47 changed by josh

  • owner changed from core to bitsweat.
  • status changed from reopened to new.

Patch still applies cleanly.

Notifying bitsweat for review.

06/07/07 23:42:50 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

(In [6962]) Register alternative template engines using ActionMailer::Base.register_template_extension('haml'). Closes #7534.

06/08/07 04:40:15 changed by bitsweat

(In [6969]) Missed svn adds. References #7534.