Jeff Barczewski on MasterView


Jeff Barczewski is talking about MasterView, a template engine for Rails. MasterView is a Ruby gem that enables the creation of Ruby/Rails views in standards-compliant XHTML. The problem with Rails views, at least in Jeff's view, is that you can't use standard HTML WYSIWYG editing tools to create and modify them. MasterView is a Ruby template language, meaning that you can use it without Rails.

Jeff showed a demo of how the tool works and how it compares to standard Rails. One advantage is the HTML and directives for a page are kept in one place instead of multiple files. In Rails the generator creates these as HTML files, a simple CSS file, and some Javascript. The Javascript is used to make the HTML files in the prototype seem live before Rails is event attached to the files using dummy data. The dummy data is replaced with real data at run time.

The views produced by MasterView are considerably more sophisticated that those produced by standard Rails. The XHTML compliance is achieved by embedding the template directives in XHTML-compliant attributes in <div/> tags. Jeff demonstrates using Mozilla Composer to edit the HTML forms and other pages. Very nice for building the view. Editing the repeated layout on one page, changes it on all of them.

An admin screen for MasterView allows you to control how pages are rendered, see the status of files rebuild the files, and so on. Tidy is built-in to clean up bad HTML.

Trying to remember which files are where can be frustrating. Moreover, if you have a team where designers were separated from developers, this architecture would probably yield a more natural workflow.