On Tuesday 28 February 2012 15:53:22 ifarkas(a)redhat.com wrote:
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.
NACK, although it works fine, some cukes are failing after applying that
patchset. The biggest problem is that rubygem-mustache isnt in Brew (package
building system for RHEL) so we will leave the patchset on the list for now.