adding a different template (.fjs) and connecting with respond_to

Hi,

I am writing a new JavaScript templating system for Rails as a plugin. I want to use the extension ".fjs". When a user "wants.js" in a respond_to block I would first like to look for a .fjs file and render it with my new templating system. If an .fjs file is not present then look for .rjs file and render with the rjs templating system.

Is this easily possible through the Rails API or is this going to be hacking the Rails core?

Any pointers how to do this or get started would be greatly appreciated.

Thank you, Peter

Dan Webb created MinusMOR, which does this with the .ejs extension. I bet that would be a good place to start.

http://www.danwebb.net/2006/11/24/minusmor-released http://svn.danwebb.net/external/rails/plugins/minus_mor/trunk/

Hi Scott,

> > Hi, > > I am writing a new JavaScript templating system for Rails as a plugin. > I want to use the extension ".fjs". When a user "wants.js" in a > respond_to block I would first like to look for a .fjs file and render > it with my new templating system. If an .fjs file is not present then > look for .rjs file and render with the rjs templating system.

Dan Webb created MinusMOR, which does this with the .ejs extension. I bet that would be a good place to start.

danwebb.net - MinusMOR Released! http://svn.danwebb.net/external/rails/plugins/minus_mor/trunk/

I wanted to write exactly what MinusMOR does (i just picked on letter away in the extension). Wrapping JavaScript in Ruby seems like a bad idea after using RJS for even a short time. I hope a bunch of Railers jump on the MInusMOR bandwagon. Great stuff!

This was literally the next project on my list. I am happy it already has been done. :smiley:

Thanks for the link!

:smiley:

Peter