WATagBrush subclass ZurbGenericTag ...change tag dynamically?

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

WATagBrush subclass ZurbGenericTag ...change tag dynamically?

gettimothy
Hi all.

I am creating the analog of the bootstrap framework for Squeak using the Zurb Foundation framework



Its coming along nicely and I am thinking ahead to the refactoring phase...

And it would be helpful if I could change the 


WATagBrush subclass: #ZurbGenericTag
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Zurb-Core-Canvas'

the tag method returns:

tag
^ 'div'

Methods on that, model the bootstrap with lots of beFoo methods that set the class='bar' and others that set the self attributeAt:'funky' put:'town'

Here's the issue.  For the Accordian thingy, the docs here: https://foundation.zurb.com/sites/docs/accordion.html#basics
read in part:


The container for an accordion needs the class .accordion, and the attribute data-accordion. Note that in these examples, we use a <ul>, but you can use any element you want.

Now, the question.

I am subclassing UnorderedList instead of the GenericTag.


WAUnorderedListTag subclass: #ZurbAccordianTag
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Zurb-Core-Canvas-Containers'
At this stage that means some duplicate "beFoo" methods between the two things.

For simplicity reasons, I don't want to re-invent the wheel, but want to keep the example framework (example Browser in bootstrap app) closely aligned to the online documentation.

However, if I can dynamically change the
tag ^'div'

on the ZurbGenericTag 

to 


tag ^'ul'
then I can centralize those methods in ZurbGenericTag, make ZurbAccordianTag a subclass of it and use the "dynamic change the tag'....

Or...why not just override the method?

Good idea? Bad Idea?

thx






_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WATagBrush subclass ZurbGenericTag ...change tag dynamically?

Esteban A. Maringolo
Yes, you might end up duplicating a few methods, there is no other way
unless you want to pollute WAGenericTag (which I don't recommend).

In the case of Bootstrap I added a few extensions to WAAnchorTag to be
able to use anchor as buttons, so I implemented a #tbsBeButton, and
then the #beWarning, #beDanger, etc. that were also present in
WAButtonTag.

In your case I would subclass each specific tag based on the
"recommended" or "most used case" for these tags. Also consider using
components to implement accordions and similar stuff, the same way
that Seaside-Bootstrap does.

Regarding the data-* attributes, I added a #dataAt:/#dataAt:put:
methods, that save me from writing the "data" prefix every time I set
or access these properties, I think this should go into the trunk of
Seaside given the extended usage of it.

Hope it helps.

Esteban A. Maringolo


2018-03-21 6:39 GMT-03:00 gettimothy <[hidden email]>:

> Hi all.
>
> I am creating the analog of the bootstrap framework for Squeak using the
> Zurb Foundation framework
>
> https://foundation.zurb.com/frameworks-docs.html
>
>
> Its coming along nicely and I am thinking ahead to the refactoring phase...
>
> And it would be helpful if I could change the
>
>
> WATagBrush subclass: #ZurbGenericTag
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Zurb-Core-Canvas'
>
> the tag method returns:
>
> tag
> ^ 'div'
>
>
> Methods on that, model the bootstrap with lots of beFoo methods that set the
> class='bar' and others that set the self attributeAt:'funky' put:'town'
>
> Here's the issue.  For the Accordian thingy, the docs here:
> https://foundation.zurb.com/sites/docs/accordion.html#basics
> read in part:
>
>
> The container for an accordion needs the class .accordion, and the attribute
> data-accordion. Note that in these examples, we use a <ul>, but you can use
> any element you want.
>
>
> Now, the question.
>
> I am subclassing UnorderedList instead of the GenericTag.
>
>
> WAUnorderedListTag subclass: #ZurbAccordianTag
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Zurb-Core-Canvas-Containers'
>
> At this stage that means some duplicate "beFoo" methods between the two
> things.
>
> For simplicity reasons, I don't want to re-invent the wheel, but want to
> keep the example framework (example Browser in bootstrap app) closely
> aligned to the online documentation.
>
> However, if I can dynamically change the
>
> tag ^'div'
>
>
> on the ZurbGenericTag
>
> to
>
>
> tag ^'ul'
>
> then I can centralize those methods in ZurbGenericTag, make ZurbAccordianTag
> a subclass of it and use the "dynamic change the tag'....
>
> Or...why not just override the method?
>
> Good idea? Bad Idea?
>
> thx
>
>
>
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside