[Wee-talk] Re: Wee 0.4.1

Michael Neumann mneumann at ntecs.de
Wed Jan 26 06:19:24 EST 2005


Avi Bryant wrote:
> On Tue, 25 Jan 2005 19:34:56 +0100, Michael Neumann <mneumann at ntecs.de> wrote:
> 
> 
>># note that css_class_for automatically prepends "css." to the
>># property, image.src_for prepends "img."
>>app.properties = {
>>   Pager => {
>>     'css.pager' => 'webtable-paging',
>>     'css.page-img' => 'webtable-page-img',
>>     'img.first' => '/tmp/first.gif'
>>   }
>>}
>>
>>If the lookup of properties turns out to be too slow, I might cache
>>successful lookups. I also think about some kind of default_properties
>>for a given class.
> 
> 
>>What do you think of this property system? Do you think it's worthwhile?
>>Any additional suggestions?
> 
> 
> Meta: we should really start a mailing list for wee-dev or possibly
> for some wider scope of "Wee and Seaside like frameworks".  I could
> ask the Seaside list if they would be interested in such discussions
> happening there, if you like...

I've CCed to wee-talk at rubyforge.org. If you could post there too?

> As for the property system, specifically relating to CSS: I went
> through a similar approach and then rejected it in favor of just using
> CSS the way it was designed, which is to say, hardcoding the CSS
> classes into a component and then having context-sensitive
> stylesheets.  To give you an idea of what I mean: the pager would
> always use "paging" and "page-img", and the webtable would have a
> "webtable" div around it, and then in your stylesheet you can have:
> 
> .paging {/* default styles for pager */}
> .webtable .paging {/* (additional) default styles for pager inside webtable */}
> .myapp .webtable .paging {/* tweaks necessary for a specific application */}
> 
> And so on.  It's perhaps not quite so flexible (CSS isn't turing
> complete, sadly...), but it's definitely more idiomatic.  What do you
> think?

Yes, I think that's fine. Well, to avoid top-level collisions 
(".paging", e.g. if you have two Pager compoenents which look 
different), you could use a property, only for the toplevel element:

   r.div.css_class_for('css.pager').with {
     ..
     r.xxx.css_class(
   }

That's probably better than using a property for every element.
I had implemented a simpler approach before, which just calls 
#css_namespace of the component and uses this as prefix (but this isn't 
as flexible, and an #img_path method would be needed too...).

Good news is, that the property system is completely optional. You need 
not use it! I'll leave it in and see where it's applicable and where not 
(hehe, should learn a little bit CSS2 before ;-).

Regards,

   Michael


More information about the Wee-talk mailing list