On Nov 5, 2009, at 8:27 PM, mdipierro wrote: > > you can do > > def error(text): > return TABLE(TR(TD(text)),_class='error') > > response.flash=error("what the ...!")
Right, that's the kind of thing I was thinking of, albeit with a more elaborate table. Then you can use a CSS selector like: div.flash table.error { ... } Thanks. > > On Nov 5, 9:28 pm, Jonathan Lundell <jlund...@pobox.com> wrote: >> On Nov 5, 2009, at 1:39 PM, mdipierro wrote: >> >> >> >>> well, you can do >> >>> response.flash=DIV("message",_class="error") >> >>> and handle both class "flash" and class "error" via css. >> >> That works fine if your flash html is a simple div (as it is in the >> standard layout), but it doesn't work so well if you're trying to do >> more with it. >> >> Gmail's flash display, for example, puts its flash message in a >> rounded-corner box (generated via a table). You can do that too using >> the technique you show, but you really need a wrapper function once >> the html gets more complex than a simple div (or the like). >> >> BTW, with this method, does the <div> end up getting escaped? >> >> >> >>> On Nov 5, 3:13 pm, Jonathan Lundell <jlund...@pobox.com> wrote: >>>> On Nov 5, 2009, at 12:41 PM, Russell wrote: >> >>>>> It does seem that a nice solution would be to position or shrink >>>>> the >>>>> flash message on the default layout so that it is unlikely to >>>>> cover >>>>> text. But it maybe we are trying to do too much with the flash >>>>> message? There are some messages that only deserve a quick >>>>> 'flash' - >>>>> like 'logged in'. But there are some messages that are more >>>>> important >>>>> that need to stick around. Perhaps we need two styles in the >>>>> layout...response.flash and response.notice? >> >>>> I think that'd be good, or perhaps more of an API. One way to do it >>>> would be to attach different styles to the flash, perhaps. >> >>>> For my own applications, I'd like to distinguish errors from >>>> information notices with color. Also, if an error requires that the >>>> user do something to correct it (that is, the landing page isn't >>>> really what the user was after), I'd be inclined to leave it up (no >>>> fade-out), while purely informational or greeting messages that >>>> don't >>>> require user action would fade. >> >> > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---