Luis Reis
2013-Jan-21 23:42 UTC
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: [...] <div><%= f.label :password %> <i>(leave blank if you don''t want to change it)</i><br /> <%= f.password_field :password, :autocomplete => "off" %></div> [...] It would be useful for formatting if this code could be: [...] <div><%= f.label :password, :add_content => true do %> <i>(leave blank if you don''t want to change it)</i><% end %><br /> <%= f.password_field :password, :autocomplete => "off" %></div> [...] Generating the following html: [...] <div><label for="user_password"> <i>(leave blank if you don''t want to change it)</i></label><br /> [...] 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/0XIGLU1oyH8J. For more options, visit https://groups.google.com/groups/opt_out.
Frederick Cheung
2013-Jan-22 11:37 UTC
Re: Should ActionView''s label tag helper be extended to accept a _complementary_ content block ?
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 ofmy apps seemed to work Fred> 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 >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/thSvCuhZkksJ. For more options, visit https://groups.google.com/groups/opt_out.