Please restore "label" in merb_helpers
Reported by Bill Turner | August 29th, 2008 @ 08:33 PM | in 1.0
I realize that text_field (and the like) have the :label parameter, but I like using the separate label helper, so I can put the label wherever I'd like - and not have to accept the default position.
Here's the previous syntax for reference:
<%= label 'Label Text', '', :for => "form_field" %>
Comments and changes to this ticket
-

Bill Turner August 29th, 2008 @ 09:25 PM
And here's what was removed from the lib/merb_helpers/form_helpers.rb file, for creating the labels:
# Provides a generic HTML label. # # ==== Example # <% label "Name", "", :for => "name" %> # # => <label for="name">Name</label> def label(name, contents = "", attrs = {}) tag("label", name.to_s + contents, attrs) endI didn't see any specs specifically for the label helper.
-
Bryan Ray August 29th, 2008 @ 09:59 PM
+1
I'd say a majority of the time I use the :label option on my controls, but I would still like to see the label helper method for times when I want to generate a label on my own.
There is also maybe the possibility of adding in a :label_position option to the form helper controls (see attached patch)?
-
Bryan Ray August 29th, 2008 @ 10:01 PM
patch gives the ability to do something like:
text_field :first_name, :label => "First Name", :label_position => :afterwhich would generate something like:
<input .../><label .../>(I intentionally put the "..." in the html tags, because I'm hand typing this :)
-

Bill Turner August 29th, 2008 @ 11:05 PM
That patch is a good option, but it still limits the location of the label. What if I wanted to do something like this:
<div class="label_wrapper"><label for= ... /></div> <div class="field_wrapper"><input type="text" ... /></div> etc...I'm not doing something like that, and your patch would be fine for what I'm currently using, but there could be cases where the above would be used.
-
Bryan Ray August 30th, 2008 @ 12:04 AM
This patch adds both ... the 'label' helper as well as the :label_position option to other helpers.
Does anyone else have any feedback on this?
-
Michael Klishin (antares) September 6th, 2008 @ 02:14 AM
- → Milestone changed from to 1.0
- → State changed from new to open
- → Assigned user changed from to GMFlash
-

GMFlash September 6th, 2008 @ 03:11 AM
- → State changed from open to resolved
Added a label helper. Syntax is: <%= label "First Name", :for => "first_name" %>
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
