Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Notification Message plugin?

I am about to code something for a Rails app of mine and didn't want to reinvent the wheel, hence my question:

Do you guys know any Rails Plugin that would allow an application to display notification messages that could be user specific and also allow the user to mark them as "don't show this again"?

My vision is to display a top div (like the one StackOverflow added recently), in different color with the message "title" and that would be clickable. Once clicked, it would pop up the entire message and then allow the user to mark it to prevent it to be shown again.

Is there anything like that out there? :-)

I found so far this two plugins:

  • http://github.com/jstewart/system_messages/tree/master
  • http://github.com/arya/site_notifications/tree/master

But those are rather incomplete parts of my vision

-- Felipe.

like image 244
kolrie Avatar asked Apr 17 '09 02:04

kolrie


2 Answers

It seems like system_messages (which you linked to) mostly does what you want. The SystemMessage model has header, message, and dismissed fields.

It would take just a bit of JavaScript to show an intially hidden message field when the header is clicked. The plugin already allows dismissal of the message via JavaScript if you use Prototype.

like image 184
Baldu Avatar answered Nov 15 '22 23:11

Baldu


Since I don't have enough reputation to comment - Flash isn't sufficient for a few different reasons:

  1. you're mixing view and controller code. I need to notify users, including URLs and messages that just don't belong in the controller. I can write wrapper functions to do this in views, but it's hacky.
  2. Async notification. If you're using a queue design pattern, you really need a message queue to go along with it, and show the user messages totally independent of the controller they are viewing.
  3. Hard to set state. Some messages should only be displayed to the user once. Need to create a whole message model to track what they clicked and disabled anyway.

I'm also looking for some good solution, and so far the best I can come up with is RYO. I'll ultimately stuff the display code into flash, but figuring out what and when to flash is the trick.

like image 2
teich Avatar answered Nov 15 '22 23:11

teich