Should ActionView's label tag helper be extended to accept a _complementary_ content block?

Hi,

Sometimes it is useful to use label with both a contained label and
supplied content, eg, in Devise’s default registration edit view this is
the supplied code for passwords:

[…]

<%= f.label :password %> (leave blank if you don't want to change it)
<%= f.password_field :password, :autocomplete => "off" %>
[...]

It would be useful for formatting if this code could be:

[…]

<%= f.label :password, :add_content => true do %> (leave blank if you don't want to change it)<% end %>
<%= f.password_field :password, :autocomplete => "off" %>
[...]

Generating the following html:

[…]

(leave blank if you don't want to change it)
[...]

Currently using a method (:password) is mutually exclusive with
supplying a
block.

So, in other words, if I submit a patch to do this, would it be accepted
?

Another alternative would be to have a label_content helper returning
the
calculated content.

Thanks,
Cheers,
Luis Reis

On Monday, January 21, 2013 11:42:29 PM UTC, Luis Reis wrote:

Currently using a method (:password) is mutually exclusive with supplying
a block.

You sure ? It’s documented as allowing that and a 2 second test on one of
my apps seemed to work

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs