I´m not using toastr but sweetalert2

Just changed layout.html to

    {{if response.flash and type(response.flash)==type({}):}}
       <script>
    swal(
  '{{=response.flash["title"]}}',
  '{{=response.flash["msg"] h}}',
  '{{=response.flash["type"] }}'
)
   </script>

    {{pass}}
        {{if response.flash and type(response.flash)==type(""):}}   //
because of login failures or auth errors....
       <script>
    swal(
  'Error',
  '{{= response.flash}}',
  'error'
)
   </script>

    {{pass}}

and then in any controller

session.flash=dict(title=T("Good job!"),msg=T("Comment added to the
document"),type="success")


Works for me...

2017-01-09 20:37 GMT+00:00 LoveWeb2py <atayloru...@gmail.com>:

> How did you implement this Ramos? I ended up writing a toastr function in
> a model file and using that when I needed the flash. Did you just modify
> the javascript?
>
> On Monday, January 9, 2017 at 5:00:50 AM UTC-5, Ramos wrote:
>>
>> nice ;)
>>
>> 2017-01-08 23:18 GMT+00:00 Anthony <abas...@gmail.com>:
>>
>>> Try it and see. ;-)
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to