I want to create layout components that function like my layout does.
A
layout can yield the body content, is there any way to get this
functionality in rhtml templates? For example, say I have a layout
component that has a title bar and a content area. If it is a box with
rounded corners I do not want to repeat this html everywhere, so I’ll
make a
helper. Here is what I have to do now:
<%= start_mini_window(“Log in!”) %>
log in form html here
<%= end_mini_window %>
Is it possible to do this?
<% mini_window(“Log in!”) do %>
log in form html here
<% end %>
This feels cleaner to me, but I was unable to get it working. I stopped
trying to get this working when I realized that render() only uses your
proc
block when creating a javascriptgenerator.
I looked at form_for because it is a good example of the benefits to
proc
blocks in templates. The code didn’t tell me a whole lot unfortunately.
What I really want to do is take the proc block contents and yield it
into a
string, then pass that string to a partial template. I didn’t see
form_for
doing that, but maybe I missed something.
If I can yield the proc block contents into a string, that lets me
actually
pass parameters to the block and derive benefits like form_for does.
Can
anyone explain how/if this is possible, and how it would work with
concat()?