angular-growl-2 icon indicating copy to clipboard operation
angular-growl-2 copied to clipboard

Feature of the closing options of the growl message

Open JanStevens opened this issue 11 years ago • 11 comments

hello,

After issues #53, #51 and #49 we need standardise the way we close a growl notification. A little explanation:

Right now the growl message is shown and the counter shows how long the growl message will be visible. Then a user can click on it to keep the growl notification displayed and click on it again to remove the growl. Clicking on the close button will remove the growl message immediately.

A couple of things happen and I would like to define some flows so everything is standardised and configurable and clear.

Proposal

  • Show count down timer: True/False
  • Configurable pauze option: This would be a string indicating how the user can pauze the growl notification, possibilities are: onhover, onclick, or disabled (suggestions?). Also an onpauze trigger will be called.
  • Configurable close option: This would be a string that defines how we can close the growl notification, possibilities are: onclick, onclosebutton (using this will show the close button else it will be hidden),

Possible issues

  • The disable close button would be dynamically determined instead of configurable.

This of course limits the possibilities, but will allow for easily extending the possible pauze and close handling.

Any thoughts or comments? Input very much needed as I don't know which direction to go.

JanStevens avatar Nov 10 '14 19:11 JanStevens

I like where this is heading. Configuration is great. I would want to be able to decide on a per type basis as well. Like have no timer on errors (they always stay open until closed), but allow warnings and info messages to have the standard timer, and the options outlined above as far as hover to pause and only close on clicking the close button.

morgenes avatar Nov 11 '14 17:11 morgenes

@morgenes great addition for configuration per type, thats something I forgot and is actually needed. I'll think about code structure and architecture because right now I'm not really happy with the current code.

JanStevens avatar Nov 11 '14 18:11 JanStevens

I'd love to be able to define global behaviors for each notification type and apply them once. For example by passing an object with defaults for each type during config, and have the directive angular.extend it into each new notification with any notification-specific options that might have been sent over:

{
    'error' : {
        'pauze' : 'onhover onclick',
        'close' : 'onclosebutton',
        'ttl' : 10000
    },
    'info' : {
        'pauze' : 'onhover',
        'close' : 'onclick',
        'ttl' : 4000
    },
    // config-defined defaults for types with no specific settings
    'default' : {
        'pauze' : '',
        'close' : 'onclosebutton',
        'ttl' : 3000
    }
}

alonweinstein avatar Nov 12 '14 11:11 alonweinstein

Is it possible at the moment to disable the close action triggered by a double click on a notification? I display links in my notifications, so the users can only click two times on them, quite annoying. ^^'

jgoux avatar Dec 02 '14 15:12 jgoux

I have the same question as @jgoux, I'm using persistent growls as navigation aids in a SPA, it would be nice to override the click-to-keep/click-to-close from the app config.

ZaLiTHkA avatar Dec 30 '14 01:12 ZaLiTHkA

@alonweinstein I like that API, its easy and with a couple of keywords we can define some behaviour. I'll think about it, atm the code is quite messy and could use a clean up/improvement

JanStevens avatar Jan 06 '15 11:01 JanStevens

Happy to help - any particular part of the code you want cleanup on?

alonweinstein avatar Feb 04 '15 10:02 alonweinstein

+1 for this one!

rockymontana avatar Feb 09 '15 22:02 rockymontana

hey! i am using bootstrap growl with my angularjs , i too want to add the features proposed by jan stevens , but how can i do this . following is the image showing the code i have written. please help! login_controller main_controller

priyanshi626 avatar Aug 25 '15 09:08 priyanshi626

CSS for disabling close on click (Proposal 2)

.growl-container > .growl-item { pointer-events: none }

alejandr0bovino avatar Sep 09 '15 00:09 alejandr0bovino

@alejandr0bovino : pointer-events: none doesnot work here.

Looking for any other alternatives.

rahulmatty avatar Oct 06 '18 09:10 rahulmatty