This project is archived and is in readonly mode.
tag_options should properly handle arrays
Reported by Tomasz Mazur | January 12th, 2009 @ 10:27 PM | in 2.x
example:
['tom' => 'admin', 'jim' => 'user'].each_pair do |nick, role|
<%= content_tag(:span, nick, :class => ["nickname", role]) %>
end
should render
<span class="role admin">tom</span>
<span class="role user">him</span>
instead of:
<span class="roleadmin">tom</span>
<span class="roleuser">him</span>
Everyone who makes lots of complicated views (with proper css classes usage) knows that using interpolation isn't quite handy....
Comments and changes to this ticket
-
Tomasz Mazur January 12th, 2009 @ 11:08 PM
fixed example:
['tom' => 'admin', 'jim' => 'user'].each_pair do |nick, role| <%= content_tag(:span, nick, :class => ["role", role]) %> end
-
CancelProfileIsBroken August 4th, 2009 @ 05:43 PM
- Tag set to bugmash
- State changed from new to incomplete
Needs tests
-
Rizwan Reza August 8th, 2009 @ 09:11 PM
- Assigned user set to Pratik
- Tag changed from bugmash to bugmash, verified
verified.
+1 The patch attached includes tests. I think this will help creating multiple content tags.
-
Nick Quaranto August 8th, 2009 @ 10:02 PM
- Assigned user cleared.
- Tag changed from bugmash, verified to bugmash
Added some tests and refactored Tomasz's implementation. You'll have to apply his patch then mine to get this working cleanly.
-
Nick Quaranto August 8th, 2009 @ 10:05 PM
- Assigned user set to Pratik
- Tag changed from bugmash to bugmash, verified
Looks like Rizwan implemented it as well, sans refactoring. I didn't reload the page to check before, so I'm adding the tags back in.
-
Dan Croak August 8th, 2009 @ 10:10 PM
+1 verified
tag_options.diff and 0001-Added-tests-for-using-an-Array-in-tag_options-and-re.patch apply cleanly
and rake test_action_pack runs green on 2-3-stable
-
Josh Nichols August 8th, 2009 @ 10:11 PM
- Assigned user cleared.
+1, because I usually end up using :class => "something #{some_variable}" instead of dealing with an array.
Verified the patches are cool.
-
Nick Quaranto August 8th, 2009 @ 10:12 PM
- Assigned user set to Pratik
Here's a patch that gives credit to Tomasz and is based off master.
-
Rizwan Reza August 8th, 2009 @ 10:46 PM
@@ ruby {'tom' => 'admin', 'jim' => 'user'}.each do |nick, role| <%= content_tag(:span, nick, :class => ["nickname", role]) %> end
@@This works well with these patches too. Hash is good too. :)
-
José Valim August 8th, 2009 @ 10:47 PM
- State changed from incomplete to resolved
- Tag changed from bugmash, verified to verified
-
Repository August 9th, 2009 @ 05:12 AM
(from [5786395760f1e1906c878df4023cac3741e66e87]) Allow content_tag options to take an array [#1741 state:resolved] [rizwanreza, Nick Quaranto]
Example:
content_tag('p', "limelight", :class => ["song", "play"]) # =>limelight
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/5786395760f1e1906c878df4023cac...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 1741 tag_options should properly handle arrays (from [5786395760f1e1906c878df4023cac3741e66e87]) Allow c...