On Tuesday, January 11, 2011 at 2:38 PM, Puneet Kishor wrote:
On Tuesday, January 11, 2011 at 2:22 PM, damien krotkine wrote:
On 11 January 2011 19:44, Puneet Kishor <punk.kish@gmail.com> wrote:
On Tuesday, January 11, 2011 at 11:48 AM, damien krotkine wrote:
I've re-implemented it to be more Rails-like, as sukria said.
https://github.com/dams/Dancer-Plugin-FlashMessage
and on CPAN, pending mirrors refresh.
The funny part of the story ? the effective code is only 30 lines long. Talking about Perl and Dancer expressiveness...
Great job, and thanks! But, I don't really understand the point of this flash message (for the longest time I thought it was something to do with Adobe Flash). Is there a demo of it in action that I can see? I am trying to visualize which nail I can bang in with this hammer. Where would I use this, and how?
Hm, for example these nice yellow pop up saying "row deleted", and which fade out after few seconds...
So basically it's some kind of messages to alert / inform the user after an action.
I was guessing as much, but wasn't sure. Thanks for confirming.
I have been implementing this functionality via Ajax and jQuery (I tried a bunch, including Gritter [1]), but have now settled on jBar [2], and am very happy with it (there are tons of Growl-type jQuery plugins). The process flow is very simple --
a. user does something (logs in, logs out, or saves or deletes a record by clicking on a button) b. an Ajax query is fired that is trapped by a Dancer get/post, as appropriate c. a return value is sent back that jQuery catches, and fires a jBar message
There is nothing unusual on Dancer side. There is this little snippet on the client side
C = { save: function() { $.ajax({ url : this.config.uri + "/save", type : "POST", data : query_str, dataType: "json", error : function() { alert("Error loading html document"); }, success : function(rc) { (rc === "0") ? C.growl("Error", "Failed to save") : C.growl("Success", "Saved successfully"); } }}); },
growl: function(title, text) { $.fn.bar({ color : '#1E90FF', background_color : '#FFFFFF', removebutton : false, message : text, time : 4000 }); } };
Nothing against the plugin, but I just want to make sure I am not missing out on any goodie that I am not recognizing.
[1] http://boedesign.com/blog/2009/07/11/growl-for-jquery-gritter/ [2] http://tympanus.net/codrops/2009/10/29/jbar-a-jquery-notification-plugin/
Just realized, I am tried both Gritter and jBar (noted above), but ended up using a much simpler notification plugin found at http://www.programmingmind.com/jquery-notification-v1.1 Puneet.