Row Alternation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Row Alternation

David Farber-3
Here's a little change set I whipped up today.  It annotates Table  
rows with 'class=odd' or 'class=even' so that you can apply css to  
color alternate rows.  Comments, criticisms, etc., welcome.

David



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki

RowAlternation.2.cs (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Row Alternation

Damien Cassou-3
On Tue, Nov 18, 2008 at 12:28 AM, David Farber <[hidden email]> wrote:
> Here's a little change set I whipped up today.  It annotates Table rows with
> 'class=odd' or 'class=even' so that you can apply css to color alternate
> rows.  Comments, criticisms, etc., welcome.

Part of your code reads:

visitTableRow: anObject
        html tableRow
                class: (anObject rowAlternation isNil ifFalse: [ anObject rowAlternation ]);
                with: [ super visitTableRow: anObject ]


class: (anObject rowAlternation isNil ifFalse: [ anObject rowAlternation ])

seems to be equivalent to:

class: anObject rowAlternation

which seems wrong because you will add a nil class in some cases.

What about:

html tableRow
                class: anObject rowAlternation if: anObject rowAlternation notNil


--
Damien Cassou
http://damiencassou.seasidehosting.st

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Row Alternation

Lukas Renggli
#withIndexDo: is not portable to Smalltalk dialects other than
Squeak/Pharo (see Seaside coding guidelines).

Also this feature should be purely a thing in PRViewRenderer. I don't
think that should be stored in the document model.

Lukas

On Tue, Nov 18, 2008 at 7:59 AM, Damien Cassou <[hidden email]> wrote:

> On Tue, Nov 18, 2008 at 12:28 AM, David Farber <[hidden email]> wrote:
>> Here's a little change set I whipped up today.  It annotates Table rows with
>> 'class=odd' or 'class=even' so that you can apply css to color alternate
>> rows.  Comments, criticisms, etc., welcome.
>
> Part of your code reads:
>
> visitTableRow: anObject
>        html tableRow
>                class: (anObject rowAlternation isNil ifFalse: [ anObject rowAlternation ]);
>                with: [ super visitTableRow: anObject ]
>
>
> class: (anObject rowAlternation isNil ifFalse: [ anObject rowAlternation ])
>
> seems to be equivalent to:
>
> class: anObject rowAlternation
>
> which seems wrong because you will add a nil class in some cases.
>
> What about:
>
> html tableRow
>                class: anObject rowAlternation if: anObject rowAlternation notNil
>
>
> --
> Damien Cassou
> http://damiencassou.seasidehosting.st
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Row Alternation

David Farber-3
In reply to this post by Damien Cassou-3

On Nov 17, 2008, at 11:59 PM, Damien Cassou wrote:

> On Tue, Nov 18, 2008 at 12:28 AM, David Farber <[hidden email]>  
> wrote:
>> Here's a little change set I whipped up today.  It annotates Table  
>> rows with
>> 'class=odd' or 'class=even' so that you can apply css to color  
>> alternate
>> rows.  Comments, criticisms, etc., welcome.
>
> Part of your code reads:
>
> visitTableRow: anObject
> html tableRow
> class: (anObject rowAlternation isNil ifFalse: [ anObject  
> rowAlternation ]);
> with: [ super visitTableRow: anObject ]
>
>
> class: (anObject rowAlternation isNil ifFalse: [ anObject  
> rowAlternation ])
>
> seems to be equivalent to:
>
> class: anObject rowAlternation
>
> which seems wrong because you will add a nil class in some cases.

You are right--the ifFalse is redundant.  I originally had more  
complicated logic to try to avoid a nil argument to class:.

> What about:
>
> html tableRow
> class: anObject rowAlternation if: anObject rowAlternation notNil

Cool.  I didn't see class:if:.

Thanks,
David


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Row Alternation

David Farber-3
In reply to this post by Lukas Renggli
On Nov 18, 2008, at 12:41 AM, Lukas Renggli wrote:

> #withIndexDo: is not portable to Smalltalk dialects other than
> Squeak/Pharo (see Seaside coding guidelines).\

Ugh.

> Also this feature should be purely a thing in PRViewRenderer. I don't
> think that should be stored in the document model.

I'd be interested to hear more about why you think that.

David


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki