Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it there a Ruby equivalent of Java's Wicket?

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 ?

like image 443
rodrigob Avatar asked Oct 14 '22 11:10

rodrigob


1 Answers

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>
like image 87
Jörg W Mittag Avatar answered Oct 29 '22 22:10

Jörg W Mittag