I've been working on a lot of reports lately, and I do something like
this...
in my application controller...

def stripe
  return cycle("odd", "even")
end

in my views...

%table
  %tr{:class => stripe}
    ...

in my sass...

tr.odd
  :background #F6F6F6

tr.even
  :background #C6C6C6

Let me know if that doesn't work for some reason.

- Jeff

On 12/18/07, Evgeny <[EMAIL PROTECTED]> wrote:
>
> Or you can extract the Rails cycle() helper into your own helper module,
> and use that module when you run the Haml engine.
>
> (note, cycle() is a method in rails, not ruby)
>
> On Dec 18, 2007 1:54 PM, Mislav Marohnić < [EMAIL PROTECTED]>
> wrote:
>
> > On Dec 18, 2007 12:45 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > wrote:
> >
> > >
> > > I had a question that I wasn't able to find an answer for anywhere on
> > > the web - that might be a bad sign.  I'm trying to zebra stripe lists
> > > using something like Ruby's cycle() view helper, but haml doesn't seem
> > >
> > > to like me even thinking about it.  Is there some easy, dead simple
> > > way that I'm just missing to zebra stripe lists with haml?
> >
> >
> >
> > Try this:
> > %li{ :class => (index % 2).zero?? 'even' : 'odd' }
> >
> > When using ActionView in Rails, you can use the `cycle` helper instead
> > of the arithmetic and ternary operator used in my example.
> >
> >
> >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to