Closed triemstr closed 9 years ago
+1 to this. I was surprised to notice that this is not possible.
I'd like to have a go at it myself, I just fear that time and skill will be in the way. :)
This bit me again, but I came up with a workaround. ActionView::Helpers::CaptureHelper#capture
to the rescue!
For example, @triemstr's code above could be written as:
<% label_contents = capture do %>
Email
<span id="req_8" class="req">*</span>
<% end %>
<%= negative_label_tag @captcha, :Field8, label_contents, :id => 'title8', :class => 'desc' %>
Of course it would be much better if the view helpers accepted blocks, but at least there is a way to deal with the current situation.
I tried to convert this:
to this:
And the "span" block completely disappears. If I do a regular label_tag it works just fine.
Any chance this can be improved to allow blocks?
Thanks greatly. Kevin