The idea would be to replace ERB with templates that are pure XHTML and that the view would be pure code manipulating the template content.
Have this been done already ?
There used to be Lilu by Yuri Rashkovskii, but it is no longer maintained. It is still available, though, so if you're interested you can maintain it yourself. (It's very little code, actually, and the templating part proper doesn't need to change anyway. The only part that probably does need to change is the integration into the Rails view engine, and that should be fairly trivial, now that Rails 3 actually does have a proper view engine.)
A newer system that leverages HTML5's data-
attributes, is RuHL by Andrew Stone. Here's a quick taste (stolen from the website):
<!-- view.html -->
<html>
<body>
<p data-ruhl="say_hello"/>
</body>
</html>
# model.rb
def say_hello
"Hello World"
end
<!-- result.html -->
<html>
<body>
<p>Hello World</p>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With