Feature request
Closed this issue · 8 comments
Hi,
I've been using your gem for a few days, and a useful feature seems to be missing: passing options to gflash method in a view.
I mean: ok it works great, but I can't set the time when the notification disappears and in my case the default time is really too long.
Right now, I have to set global default options by extending the JS object, but it's just for every single view so it's not perfect.
Anyway, nice gem =)
Thanks for the feature request. Good point. I'll try and add it this weekend.
I was about to implement extending the gritter objects via gflash, but I was wondering: have you tried the extend_gritter method in this gem? It allows you to change the default time. I'm not sure if I should add the same functionality to gflash that's already in extend_gritter. What do you think?
That's exactly what I did to make it work. But the way I am using your gflash, it would be great to be able to choose from the controller different timings. Right now it's only one timing for every messages, and in my case it's not very pleasant.
Aah ok, it's clear to me now. So you would like to add extra options to gflash in the controller? I thought you meant the view gflash helper. ;) What options would you like to declare inside the controller? You want to change the time, but are there other options? These are all the options:
:sticky => true # => Allows you to make the notification sticky.
:time => 4000 # => Allows you to set the time when the notification disappears (in ms).
:class_name => "gritter" # => Allows you to set a different classname.
:before_open => "alert('Opening!');" # => Execute javascript before opening.
:after_open => "alert('Opened!');" # => Execute javascript after opening.
:before_close => "alert('Closing!');" # => Execute javascript before closing.
:after_close => "alert('Closed!');" # => Execute javascript after closing.
In my case, I only need :time.
But once you've done the trick for one it's not hard for you to allow them all, is it?
That's true, but things like 'after_open' require JavaScript. I think it looks pretty dirty when you add that to the Controller. I don't have a problem with sticky and class_name. What do you think?
Looks dirty to me too, so the 3 first should be enough.
Ok, great. I'll try and add it tonight then. :)