This project is archived and is in readonly mode.
Let label helpers accept blocks
-
Stephen Celis
- Tag set to action_view, block, form_helper, form_tag_helper, label, label_tag, to_label_tag
-
Stephen Celis
- Tag changed from action_view, block, form_helper, form_tag_helper, label, label_tag, to_label_tag to action_view, block, form_helper, form_tag_helper, label, label_tag, patch, to_label_tag
-
Chris Hapgood
Double bonus for this enhancement -thanks Stephen. I see that you have also made the "name" attribute optional -fantastic. Now one can implicitly apply a label to the enclosed input without having to worry about id matching with the 'for' attribute:
label_tag nil, "Your Name" do
text_field_tag 'name' endIMO, the signature of #label_tag (and #label) should evolve to better support this practice as it reduces the need to keep DOM ids in sync between the input and the label. Perhaps by counting args to label_tag and assuming a single string argument is a contextual label.
-
Stefano Diem
Pretty cool!
I use a lot of labels with images inside, especially on radiobuttons and checkboxes to be able to check the corresponding field without having to resort to javascript, and things usually get very messy having to add them inside the label and label_tag methods. So this patch is something i'm realy looking for! Do you need help with anything?
-
Stephen Celis
Biggest help would be to test the patch out and get others to do so.
Once a few people approve, we can mark this "confirmed."
-
Stephen Celis
Updated patch rebased against master.
-
José Valim
- Milestone cleared.
- Assigned user set to José Valim
-
Adrian Sanchez
It's a good feature,
I try, run the test and work fine.
Thank you Stephen
-
Dan Pickett
- Tag changed from action_view, block, form_helper, form_tag_helper, label, label_tag, patch, to_label_tag to action_view, block, bugmash, form_helper, form_tag_helper, label, label_tag, patch, to_label_tag
-
Jeff Kreeftmeijer
+1
Applies cleanly to master, great patch!
-
Lake
+1
Applies cleanly to master and tests pass. Nice work.
-
Stephen Celis
- Tag changed from action_view, block, bugmash, form_helper, form_tag_helper, label, label_tag, patch, to_label_tag to action_view, block, bugmash, form_helper, form_tag_helper, label, label_tag, patch, to_label_tag, verified
-
Repository
- State changed from new to resolved
(from [d18a2742e01d195eb2d228207062aff49f7eb854]) Improve previous patch a bit [#3645 Let label helpers accept blocks state:resolved] http://github.com/rails/rails/commit/d18a2742e01d195eb2d228207062af...
