Why doing that? You can't just style differently the actual web2py flash
popup in the web2py.css file to achieve what you want? I mean flash message
is flash message...

Richard

On Fri, Jan 6, 2017 at 10:43 AM, LoveWeb2py <atayloru...@gmail.com> wrote:

> Hello,
>
> I have created my own response.flash
>
> Here is the code:
>
>
> def notification(message, mtype):
>     a = "<script>\n"
>     a += "$(\"notify\").ready(function() {\n"
>     a += "toastr.options.timeOut = 2000; // 1.5s\n"
>     a += "toastr.{mtype}('{message}');\n".format(mtype=mtype, message=message)
>     a += "$('#linkButton').click(function() {\n"
>     a += "toastr.success('Click Button');\n"
>     a += "});\n"
>     a += "});\n"
>     a += "</script>"
>     a = XML(a)
>     return a
>
>
>
>
> The problem is when I call it using auth.messages.logged_in = 
> notification('Signed In', 'success') I get two pop ups of the message.
>
> I suspect this has something to do with the way .flash is defined in 
> web2py.js because when I comment out
>
>         main_hook: function () {
>         /*var flash = $('.w2p_flash');*/
>         /*flash.hide();*/
>         /*if (flash.html()) web2py.flash(flash.html());*/
>         web2py.ajax_init(document);
>         web2py.event_handlers();
>         web2py.a_handlers();
>         web2py.form_handlers();
>     }
> };
>
>
> It works fine! Is this a bug or is something wrong with the way I'm
> creating a custom response.flash
>
>
> --
> 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