MasterView Rendering
A diagram representing how MasterView transforms a template into the equivalent rhtml
MasterView template -
store/new.html<html
mv:generate="layouts/store.rhtml">
<body>
<h1>My
Store</h1>
<div
mv:generate="store/new.rhtml"
mv:gen_replace="@content_for_layout">
<h2>New</h2>
<form mv:form=":action => 'new'">
<div mv:gen_partial=":partial
=> 'store/form'">
Name:
<input type="text"
size="20"
mv:text_field="product,
name"/>
Description:
<text_area rows="5" cols="40"
mv:text_area="product, desc"/>
</div>
<input
type="submit"
value="save"
mv:submit=""/>
</form>
</div>
</body>
</html>
layouts/store.rhtml
<html>
<body>
<h1>My
Store</h1>
<%= @content_for_layout
%>
</body>
</html>
store/new.rhtml
<div>
<h2>New</h2>
<%= form_tag(:action =>
'new') %>
<%=
render :partial
=> 'store/form' %>
<%=
submit_tag
'save' %>
</form>
</div>
store/_form.rhtml
<div>
Name:
<%=
text_field 'product',
'name',
:size => 20
%>
Description:
<%=
text_area
'product',
'desc',
:cols
=> 20,
:rows => 5
%>
</div>
=>
=>
=>
=>
=>