[EMAIL PROTECTED] schrieb:
> These are good tips.  Here's a related suggestion for 2.0: make the
> flash work like a logger.  For example:
> 
> turbogears.flash.info("An informational message...")
> turbogears.flash.error("A big freakin' error!")
> 
> Each type of message would map to a CSS class, so you'd get something
> like:
> 
> <div id="flash" class="flash error">
> A big freakin' error!
> </div>
> 
> That way, you could style the different types of flash messages with
> simple CSS and hopefully avoid tricky DOM stuff.

I have a widget that does almost exactly that. I haven't packaged it as
a separate widget yet, but I use it in my applications. You can look at
the source code of my CBlog app [1] to see it in use. Have a look at the
following files.

cblog/fflash.py
cblog/widgets/fancyflash.py
cblog/static/javascript/fancyflash.js
cblog/static/css/fancyflash.css

It also need the RUZEE.events JS library [2] packaged as a widget, which
can be found in the cblog/widgets/jslibs directory.

I works by encoding the flash message as JSON data and decoding it when
the page is rendered. To use it, you need to put the following in your
master template:

${tg_fancyflash(tg_flash)}

and then put the 'fancyflash' widget in tg.include_widgets, so that the
widget is present on every page. I use a function called
'register_sitewidgets' for that. It is defined in the file
cblog/widgets/base.py and called in cblog/controllers/__init__.py.


I hope I'll have the time to package fancyflash as a standalone widget
soon. If anybody wants to have a shot at it, feel free to do it, just
include me in the credits ;-) (and Splee, whose idea it was in the first
place)

Chris


[1] http://chrisarndt.de/projects/cblog/download/ (Unfortunately my blog
where you could see CBlog in action, is down atm, because the server
broke down)
[2] http://www.ruzee.com/blog/ruzeeevents/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to