|
List Info
Thread: zebra striping
|
|
| zebra striping |

|
2007-12-18 05:45:15 |
Hi there,
First off, thanks to those who created/actively work on haml
- it's
just what the doctor ordered!
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?
Thanks much in advance.
- Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: zebra striping |

|
2007-12-18 05:54:10 |
|
On Dec 18, 2007 12:45 PM, rob.sterner gmail.com">rob.sterner gmail.com < rob.sterner gmail.com">rob.sterner gmail.com> 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. I9;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' : 'odd39; }
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 haml googlegroups.com To unsubscribe from this group, send email to haml-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: zebra striping |

|
2007-12-18 09:58:35 |
|
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ć <
mislav.mar ohnic gmail.com">mislav.marohnic gmail.com> wrote:
Try this: %li{ :class => (index % 2).zero?? 'even' : 'odd39; }
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 haml googlegroups.com To unsubscribe from this group, send email to haml-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: zebra striping |

|
2007-12-18 10:32:52 |
|
| 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to haml googlegroups.com To unsubscribe from this group, send email to haml-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: zebra striping |

|
2007-12-18 18:27:08 |
Why have both 'odd' and 'even' when just one of them and an
empty one
is enough? Like cycle("","hi")
On 12/18/07, Jeff Casimir <jeff casimircreative.com>
wrote:
> 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 <evgeny.zislis gmail.com> 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ć <
mislav.marohnic gmail.com>
> > wrote:
> >
> > > On Dec 18, 2007 12:45 PM, rob.sterner gmail.com
<rob.sterner gmail.com>
> > > 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 haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: zebra striping |

|
2007-12-18 21:23:52 |
|
Sure, you could do that, but I prefer to be explicit. My app is quite large and has a variety of table layouts, so it's preferable to express exactly what I want.
- Jeff
On 12/18/07,
Evgeny < evgeny.zislis gmail.com">evgeny.zislis gmail.com> wrote:
Why have both 'odd39; and 'even' when just one of them and an empty one is enough? Like cycle("","hi")
On 12/18/07, Jeff Casimir < jeff casimircreative.com">jeff casimircreative.com
> wrote: > 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 < evgeny.zislis gmail.com">evgeny.zislis gmail.com
> 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æ < mislav.marohnic gmail.com">mislav.marohnic gmail.com> > > wrote: > > > > > On Dec 18, 2007 12:45 PM,
rob.sterner gmail.com">rob.sterner gmail.com < rob.sterner gmail.com">rob.sterner gmail.com> > > > 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. I9;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' : 'odd39; } > > > > > > 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 haml googlegroups.com To unsubscribe from this group, send email to haml-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: zebra striping |

|
2007-12-19 00:57:26 |
|
You prefer every row to be of alternating color. And I prefer every other row to be different from the default color. Guess it does not matter in the end result  On 12/19/07,
Jeff Casimir < jeff casimircreative.com">jeff casimircreative.com> wrote:Sure, you could do that, but I prefer to be explicit. My app is quite large and has a variety of table layouts, so it's preferable to express exactly what I want.
- Jeff
On 12/18/07,
Evgeny < evgeny.zislis gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">evgeny.zislis gmail.com> wrote:
Why have both 'odd39; and 'even' when just one of them and an empty one is enough? Like cycle("","hi")
On 12/18/07, Jeff Casimir < jeff casimircreative.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
jeff casimircreative.com
> wrote: > 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 < evgeny.zislis gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
evgeny.zislis gmail.com
> 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ć < mislav.marohnic gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mislav.marohnic gmail.com>
> > wrote: > > > > > On Dec 18, 2007 12:45 PM,
rob.sterner gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rob.sterner gmail.com < rob.sterner gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rob.sterner gmail.com> > > > 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. I9;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' : 'odd39; } > > > > > > 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 haml googlegroups.com To unsubscribe from this group, send email to haml-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: zebra striping |

|
2007-12-19 08:31:59 |
Excellent - yeah, it's a matter of style I guess. I like
extracting
it out into a helper file that can take arguments (for
custom flip/
flop CSS classes). Thanks for the tips!
- Rob
On Dec 19, 1:57 am, Evgeny <evgeny.zis... gmail.com> wrote:
> You prefer every row to be of alternating color. And I
prefer every other
> row to be different from the default color. Guess it
does not matter in the
> end result
>
> On 12/19/07, Jeff Casimir <j... casimircreative.com> wrote:
>
>
>
> > Sure, you could do that, but I prefer to be
explicit. My app is quite
> > large and has a variety of table layouts, so it's
preferable to express
> > exactly what I want.
>
> > - Jeff
>
> > On 12/18/07, Evgeny <evgeny.zis... gmail.com> wrote:
>
> > > Why have both 'odd' and 'even' when just one
of them and an empty one
> > > is enough? Like
cycle("","hi")
>
> > > On 12/18/07, Jeff Casimir <j... casimircreative.com > wrote:
> > > > 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
<evgeny.zis... gmail.com > 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æ < mislav.maroh... gmail.com
>
> > > > > wrote:
>
> > > > > > On Dec 18, 2007 12:45 PM,
rob.ster... gmail.com <
> > > rob.ster... gmail.com>
> > > > > > 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 haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-8]
|
|