Add ActionView::Helpers::TextHelper#current_cycle to return the current cycle for better design options.
Reported by Ken Collins | June 14th, 2008 @ 07:38 PM | in 2.2
Access to the current value returned by cycle() helps in designing tables that have col and row spans beyond the normal 1 row zebra strip. The current_cycle() method uses the new Cycle#current_value method to return just that. The Cycle class was also re-factored a bit to keep things DRY, specifically the methods for getting the next and previous index.
Tests included cover the cases for returning the current cycle when the cycle object has a name, or not, or even more than two items. Tests included also show that calling current_cycle accidently before a cycle object was created is safe to do, just like reset_cycle.
This addition will give designers a broader range of options with cycle. Especially when needing a simple way to get the current cycle in a partial rendered further below the initial cycle() call.
Comments and changes to this ticket
-
Jeremy Kemper June 16th, 2008 @ 12:24 PM
- → Assigned user changed from to Jeremy Kemper
- → Milestone changed from to 2.2
- → State changed from new to open
-
Brennan Dunn June 16th, 2008 @ 04:29 PM
I can definitely see how being able to access the current value of a cycle would be useful, especially in the event that the value of the current cycle could go beyond setting an individual class name, etc. +1
-
Chris Lloyd August 26th, 2008 @ 09:24 AM
- → Tag changed from to actionpack actionview current_cycle cycle patch texthelper
+1 tests pass
-

Repository August 28th, 2008 @ 07:08 AM
- → State changed from open to resolved
(from [f277e1d8fddfa417104c6fe095c15559f0c8713d]) Added TextHelper#current_cycle to return the current cycle for better design options.
[#417 state:resolved]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...
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 »
Source available from github
The Git repository resides at http://github.com/rails
Check out the current development trunk (Edge Rails) with:
git clone git://github.com/rails/rails.git
Creating or reviewing a patch
See the contributor guide.
Creating a feature request
Please don't. If you want a new feature in Rails, you'll have to pull up your sleeves and get busy yourself. Or convince someone else to do it. See the contributor guide on how to get going. But posting them here is just going to lead to ticket root.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.
Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too".
