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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe@googlegroups.com.
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 outmain_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