how about setting a standard fadeout to response.flash?

213 views
Skip to first unread message

Mika Sjöman

unread,
Mar 26, 2013, 11:36:43 AM3/26/13
to web...@googlegroups.com
Hi

Had a user pointing out how irritating it was that the response.flash never goes away automatically. Found this fix thou in the group, how about making a standard 4 second fadeout on it?

in web2py.js:

var flashBox = jQuery(".flash"), flashTimer;
  flashBox
.click(function(){
      
if (flashTimer) clearTimeout(flashTimer);
      flashBox
.fadeOut(400, function(){jQuery(".flash").html('')});
  
});
  flashTimer = setTimeout(function(){flashBox.fadeOut(400, function(){jQuery(".flash").html('')});}, 4000); 

Niphlod

unread,
Mar 26, 2013, 12:18:48 PM3/26/13
to web...@googlegroups.com
we should add some features to the standard flash message .... there are some messages that are good to behave as "sticky" (click ensures the message is read by the user) and some that are "niceties" that can fade out .
We should only agree on which features use and what variables use as a standard.
I'm adding it to the roadmap but feel free to fiel a bug on googlecode pointing to this thread.

LightDot

unread,
Mar 26, 2013, 12:55:12 PM3/26/13
to web...@googlegroups.com
I prefer to keep web2py.js stock, to ease updates, so I add a similar fadeout js to layout.html when I need it.

I'm not sure I'd alter the default though. App user can miss a message that fades out quickly, so I prefer to leave such decisions to the UI designer. We have apps that have flash messages with a fixed timeout (4-8 sec if I remember correctly), apps that have flash messages with no time out at all and apps entirely without flash messages. All this is a valid design approach and I see no benefit to changing the default, since one solution will never fit all usage cases. Perhaps it would benefit web2py users if fadeout was pre-set in code as a variable (ie. off or value in seconds)? It would be easier to hack the setting. But then again, web2py is a programming framework. web2py users are expected to know how to alter such things or at least search trough the docs and google groups.

I like the idea of having flash messages with different categories (ie. error, warning, info), which could be treated differently (sticky, fadeout, different graphical design etc.). But isn't this pushing it too far..? I mean, isn't it getting too complex? It does sound like a nice idea, though...

Regards,
Ales


On Tuesday, March 26, 2013 4:36:43 PM UTC+1, Mika Sjöman wrote:

Craig Matthews

unread,
Mar 29, 2013, 3:49:57 AM3/29/13
to web...@googlegroups.com
How about including jQuery jNotify?  http://www.myjqueryplugins.com/

Niphlod

unread,
Mar 29, 2013, 4:05:51 AM3/29/13
to web...@googlegroups.com
fits better in a plugin.
Reply all
Reply to author
Forward
0 new messages