I like this, but will it play nicely with built-in flash messages? Seems like if you get a web2py built in flash message (e.g. "logged in","logged out") it will come out with no styling since the styling is now in the function rather than the layout? Although there aren't so many built-in messages that you couldn't override them so probably not that big of an issue.
On Wednesday, February 12, 2014 10:13:03 PM UTC-5, Anthony wrote:
On Wednesday, February 12, 2014 9:48:34 PM UTC-5, Cliff Kachinske wrote:
response.flash = SPAN('flash message goes here', _class='whatever')
And since this case involves a div and a button, to avoid having to repeat all that every time, just write a function that takes a message and a flash type and generates the appropriate helper object:
def flash(message, type='info'):
return DIV(BUTTON(XML('×'), _type='button', _class='close', data=dict(dismiss='alert')),
message, class='alert alert-%s' % type)
response.flash = flash('You did it!', 'success')
Anthony
On Wednesday, February 12, 2014 8:54:46 PM UTC-5, User wrote: