Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Add ActionView::Helpers::TextHelper#current_cycle to return the current cycle for better design options.

#417

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.

Reported by Ken Collins · June 14th, 2008 @ 07:38 PM

State: resolved
Milestone: none
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: none

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • Milestone cleared.
    • State changed from new to open
    • Assigned user set to Jeremy Kemper

    June 16th, 2008 @ 12:24 PM

  2. Brennan Dunn
    Brennan Dunn

    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

    June 16th, 2008 @ 04:29 PM

  3. Chris Lloyd
    Chris Lloyd
    • Tag set to actionpack, actionview, current_cycle, cycle, patch, texthelper

    +1 tests pass

    August 26th, 2008 @ 09:24 AM

  4. Repository
    Repository
    • State changed from open to resolved

    (from [f277e1d8fddfa417104c6fe095c15559f0c8713d]) Added TextHelper#current_cycle to return the current cycle for better design options.

    [#417 Add ActionView::Helpers::TextHelper#current_cycle to return the current cycle... state:resolved]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...

    August 28th, 2008 @ 07:08 AM