List Info

Thread: zebra striping




zebra striping
user name
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 hamlgooglegroups.com
To unsubscribe from this group, send email to
haml-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: zebra striping
user name
2007-12-18 05:54:10
On Dec 18, 2007 12:45 PM, rob.sternergmail.com">rob.sternergmail.com < rob.sternergmail.com">rob.sternergmail.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&#39; : 'odd&#39; }

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 hamlgooglegroups.com
To unsubscribe from this group, send email to haml-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: zebra striping
user name
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.marohnicgmail.com">mislav.marohnicgmail.com> wrote:
On Dec 18, 2007 12:45 PM, rob.sternergmail.com" target="_blank">rob.sternergmail.com < rob.sternergmail.com" target="_blank">rob.sternergmail.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&#39; : 'odd&#39; }

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 hamlgooglegroups.com
To unsubscribe from this group, send email to haml-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: zebra striping
user name
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
&nbsp; return cycle(&quot;odd", "even")
end

in my views...

%table
 &nbsp;%tr{:class => stripe}
&nbsp;   ...

in my sass...

tr.odd
  ;:background #F6F6F6

tr.even
 &nbsp;:background #C6C6C6

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

- Jeff

On 12/18/07, Evgeny < evgeny.zislisgmail.com">evgeny.zislisgmail.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.marohnicgmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mislav.marohnicgmail.com> wrote:
On Dec 18, 2007 12:45 PM, rob.sternergmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rob.sternergmail.com < rob.sternergmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> rob.sternergmail.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?

&nbsp;
Try this:
%li{ :class => (index % 2).zero?? 'even&#39; : 'odd&#39; }

When using ActionView in Rails, you can use the `cycle` helper instead of the arithmetic and ternary operator used in my example.







&nbsp;

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

Re: zebra striping
user name
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 <jeffcasimircreative.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.zislisgmail.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.marohnicgmail.com>
> > wrote:
> >
> > > On Dec 18, 2007 12:45 PM, rob.sternergmail.com
<rob.sternergmail.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 hamlgooglegroups.com
To unsubscribe from this group, send email to
haml-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: zebra striping
user name
2007-12-18 21:23:52
Sure, you could do that, but I prefer to be explicit.&nbsp; 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.zislisgmail.com">evgeny.zislisgmail.com> wrote:
Why have both 'odd&#39; and 'even&#39; when just one of them and an empty one
is enough? Like cycle(&quot;",&quot;hi";)

On 12/18/07, Jeff Casimir < jeffcasimircreative.com">jeffcasimircreative.com > wrote:
>; I've been working on a lot of reports lately, and I do something like
> this...
&gt; in my application controller...
>
&gt; def stripe
>; &nbsp; return cycle(&quot;odd", "even")
&gt; end
>
&gt; in my views...
&gt;
> %table
>; &nbsp; %tr{:class => stripe}
&gt; &nbsp; &nbsp; ...
>
&gt; in my sass...
&gt;
> tr.odd
>; &nbsp; :background #F6F6F6
&gt;
> tr.even
&gt; &nbsp; :background #C6C6C6
&gt;
> Let me know if that doesn't work for some reason.
&gt;
> - Jeff
>
> On 12/18/07, Evgeny < evgeny.zislisgmail.com">evgeny.zislisgmail.com > wrote:
>; >
> > Or you can extract the Rails cycle() helper into your own helper module,
&gt; > and use that module when you run the Haml engine.
&gt; >
> > (note, cycle() is a method in rails, not ruby)
>; >
> > On Dec 18, 2007 1:54 PM, Mislav Marohniæ < mislav.marohnicgmail.com">mislav.marohnicgmail.com>
> > wrote:
>; >
> > > On Dec 18, 2007 12:45 PM, rob.sternergmail.com">rob.sternergmail.com < rob.sternergmail.com">rob.sternergmail.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. &nbsp;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&#39; : 'odd&#39; }
> > >
> > > When using ActionView in Rails, you can use the `cycle` helper instead
&gt; > > of the arithmetic and ternary operator used in my example.
&gt; > >
> > >
> > >
> > >
> >
> > >
> >
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to hamlgooglegroups.com
To unsubscribe from this group, send email to haml-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: zebra striping
user name
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 < jeffcasimircreative.com">jeffcasimircreative.com&gt; wrote:
Sure, you could do that, but I prefer to be explicit.&nbsp; 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.zislisgmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">evgeny.zislisgmail.com> wrote:
Why have both 'odd&#39; and 'even&#39; when just one of them and an empty one
is enough? Like cycle(&quot;",&quot;hi";)

On 12/18/07, Jeff Casimir < jeffcasimircreative.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> jeffcasimircreative.com > wrote:
>; I've been working on a lot of reports lately, and I do something like
> this...
&gt; in my application controller...
>
&gt; def stripe
>; &nbsp; return cycle(&quot;odd", "even")
&gt; end
>
&gt; in my views...
&gt;
> %table
>; &nbsp; %tr{:class => stripe}
&gt; &nbsp; &nbsp; ...
>
&gt; in my sass...
&gt;
> tr.odd
>; &nbsp; :background #F6F6F6
&gt;
> tr.even
> &nbsp; :background #C6C6C6
&gt;
> Let me know if that doesn't work for some reason.
&gt;
> - Jeff
>
> On 12/18/07, Evgeny < evgeny.zislisgmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> evgeny.zislisgmail.com > wrote:
>; >
> > Or you can extract the Rails cycle() helper into your own helper module,
&gt; > and use that module when you run the Haml engine.
&gt; >
> > (note, cycle() is a method in rails, not ruby)
>; >
> > On Dec 18, 2007 1:54 PM, Mislav Marohnić < mislav.marohnicgmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mislav.marohnicgmail.com>
> > wrote:
>; >
> > > On Dec 18, 2007 12:45 PM, rob.sternergmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rob.sternergmail.com < rob.sternergmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> rob.sternergmail.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. &nbsp;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&#39; : 'odd&#39; }
> > >
> > > When using ActionView in Rails, you can use the `cycle` helper instead
&gt; > > of the arithmetic and ternary operator used in my example.
&gt; > >
> > >
> > >
> > >
> >
> > >
> >
>
> >
>


 

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

Re: zebra striping
user name
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 hamlgooglegroups.com
To unsubscribe from this group, send email to
haml-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )