From: Alberto Valverde <albe...@toscat.net>
Date: Sun, 18 Jan 2009 19:12:45 +0100
Local: Sun, Jan 18 2009 1:12 pm
Subject: Important! Update your TG2 apps [WAS:] Re-implement flash without sessions
Jorge Vargas wrote: Nevermind, I already implemented a helper :) read below... >> If someone wants to cook a widget or something for this or add a config >> option so TG can use one or the other or something the community will >> appreciate it (hint, Jorge, hint ;) > Ok I will :) But I can't promise I could get some time before b3, it >> One more thing: I'd finally like to change the DOM structure and CSS of >> 1) The class of the message should be conveyed in a... class attribute. >> 2) If the flash message is wrapped in a div inside the "flash" div then >> To make it easy to visualize, the dom structure that the js code >> <div id="some_id_of_your_liking"> >> So the CSS style this could be something like: >> #some_id_of_your_liking { >> #some_id_of_your_liking .ok { ....} >> Please strip the status_X prefix from the status code names, it is >> flash("lalalala", status="status_ok") >> If no one object I'll implement these *slightly* breaking changes (for http://trac.turbogears.org/changeset/6114 The quickstart template has been updated to the new DOM structure and How to upgraded your existsing apps (the following instructions could be 1) The flash message is now rendered like this (in a genshi template) <py:with vars="flash=tg.flash_obj.render('flash', use_js=False)"> Note that the tg.flash_obj.render() method returns a string so we need To enable JS flash messages and be able to cache your pages just pass 1.5) Using the helper in string based templates is easier, just do: ${tg.flash_obj.render('flash', use_js=False)} 2) Upgrade the your CSS to the new DOM structure, which is: <div ="$flash_id"> The one in the quickstart template looks like: #flash { } #flash div { padding:5px 15px 15px 55px; } #flash .ok { background:#EEEEFF url(../images/ok.png) no-repeat scroll left center; border:1px solid #CCCCEE; } #flash .warning { background:#FF9999 url(../images/error.png) no-repeat scroll left center; border:1px solid #FF3333; } #flash .alert { background:#FFFF99 url(../images/info.png) no-repeat scroll left center; border:1px solid #FFFF00; } 3) Change your code so the status string you pass to flash() does not contain the "status_" prefix, eg: status_ok -> ok This step might not be needed if you use custom status codes The tg.flash and tg.flash_status variables in the template have been Enjoy, You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||