On Apr 16, 3:13 am, Iceberg <[email protected]> wrote:
> Currently I think most of us use response.flash as a resort to give
> all kinds of feedback.
I have this in my model:
def shn_sessions(f):
"""
Extend session to support multiple flash classes
"""
response.error=session.error
response.confirmation=session.confirmation
response.warning=session.warning
session.error=[]
session.confirmation=[]
session.warning=[]
return f()
response._caller=lambda f: shn_sessions(f)
My layout.html contains:
{{if response.error:}}<div class="error">{{=response.error}}</div>
{{pass}}
{{if response.warning:}}<div class="warning">{{=response.warning}}</
div>{{pass}}
{{if response.confirmation:}}<div class="confirmation">
{{=response.confirmation}}</div>{{pass}}
My CSS:
.confirmation { color:#070; font-weight: bold; text-align: center;
border: #070 1px solid; background: url(../../img/dialog-
confirmation.png) #E5FFE5 no-repeat 5px 5px; margin-top: 0.0em; margin-
bottom: 1.0em; padding-top: 1.0em; padding-bottom: 1.0em; cursor:
pointer; }
.confirmation p em { color:#070; }
.error { color:#C00; font-weight: bold; text-align: center; border:
#C00 1px solid; background: url(../../img/dialog-error.png) #FFE5E5 no-
repeat 5px 5px; margin-top: 0.0em; margin-bottom: 1.0em; padding-top:
1.0em; padding-bottom: 1.0em; cursor: pointer; }
.error p em { color:#C00; }
.warning { color:#C00; font-weight: bold; text-align: center; border:
#FC6 1px solid; background: url(../../img/dialog-warning.png) #FFC no-
repeat 5px 5px; margin-top: 0.0em; margin-bottom: 1.0em; padding-top:
1.0em; padding-bottom: 1.0em; cursor: pointer; }
.warning p em { color:#C00; }
F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---