use mustache to abstract out html logic in javascript

This commit is contained in:
2012-11-26 17:46:33 +01:00
parent 88489804db
commit ecdac7e8c4
15 changed files with 785 additions and 83 deletions
@@ -0,0 +1,11 @@
module MustacheTemplateHandler
def self.call(template)
if template.locals.include? :locals
"Mustache.render(#{template.source.inspect}, locals).html_safe"
else
"#{template.source.inspect}.html_safe"
end
end
end
ActionView::Template.register_template_handler(:mustache, MustacheTemplateHandler)
ActionController::Base.view_paths << Rails.root.join('app', 'templates')