[PATCH conductor] Integrating Mustache.js

ifarkas at redhat.com ifarkas at redhat.com
Tue Feb 28 14:53:22 UTC 2012


This patchset is intended to solve the issue around template duplications for the haml templates and the jQuery templates used by backbone.
Mustache.js claims itself as logic-less template language which means e.g. there is no if statement provided by the language. But there are existing ruby gem and a javascript library, all ready to use.

The first patch contains a template handler for Rails. The mustache templates are used in 2 different ways:
- in rails the template compiled in the usual rails way (almost)
- for javascript the template just needs to be printed out
The template handler distinguishes the 2 mode by whether data is passed through the :mustache key or not.

Another problem with mustache would be the absence of rails helper methods. To solve this issue Petr and Tomas suggested some kind of template handler chaining so we could use erb and mustache together. Real template handler chaining hasn't come to rails yet, but something similar can be achieved. The MustacheTemplate::Handler class first compiles the template as an erb template and evaluate the rails helper methods, then compiles as a mustache template.

The rest of the patchset contains some refactored views. 




More information about the aeolus-devel mailing list