ruby - Yield in view for multiple blocks -
I am writing a small synatra-based app and want to be able to include different items in the layout. For example, additional CSS / Javascript references in title
or head
.
Currently my layout (ARB) looks like this (simplified):
& lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Hard coded title goes here & lt; / Title & gt; & Lt; Link rel = "stylesheet" ... /> & Lt; / Head & gt; & Lt; Body & gt; & Lt; H1 & gt; Hard coded title goes here & lt; / H1> & Lt; Div id = "content" & gt; & Lt;% = yield% & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;
Instead of being hard-coded and CSS / JS references, I want to accomplish something with these lines:
& lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; & Lt;% = yield: title% & gt; & Lt; / Heading & gt; & Lt; Link rel = "stylesheet" ... /> & Lt;% = yield: more_head_refs% & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; H1 & gt; & Lt;% = yield: title% & gt; & Lt; / H1> & Lt; Div id = "content" & gt; & Lt;% = yield% & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;
and be able to define the content for those blocks within each view.
Is it possible, and if so, how would I have to do it?
Comments
Post a Comment