-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved placement, individual duration, events and minor refactorings #15
base: master
Are you sure you want to change the base?
Conversation
…ted and fixed right alignment. Minor code fixes.
…ted and right alignment now really puts the notification to the right most point. Minor code fixes.
}); | ||
switch (args.position){ | ||
case 'center': templateElement.addClass('cg-notify-message-center'); | ||
templateElement.css('margin-left','-' + (templateElement[0].offsetWidth /2) + 'px'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I will take a look into that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, and thanks for this PR! I'm using it primarily because of the custom duration feature, but I certainly don't mind getting the other improvements for free as well :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fixed that part. Thanks for testing my PR! Please keep me up to date about other insufficiencies :)
Anxiously awaiting a resolution for issue #11. Will this be merged soon? |
} | ||
|
||
.cg-notify-message-left { | ||
left:1%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can both this and the right class use a px left and right. 10 or15px most likely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will fix that as soon as possible.
Thanks for the PR @snrlx. If you could take a look at the comments please. I will merge soon if so. Also, if you could squash the commits at the end that would be great. p.s. I also want to think about the events a little. It seems like there should be a more elegant way to allow the service to send events. Perhaps just triggering some events on $scope, or just having the event listeners on the service itself rather than in the individual notification's config. I would think the use-case would be for listening on all notifications rather than having to set listeners are each one as its created. |
…ead of percentages
…ted and fixed right alignment. Minor code fixes. Updated Readme added events for opening, closing and clicking a notification. improved typechecking. updated Readme fixed position typechecking, fixed remaining notifications issue fixed positioning by using classes are now read via scope, css positioning done with pixels instead of percentages
@cgross : I implemented the CSS classes with 15 pixels for the margins on the left and right side. The CSS classes are now added to the DOM via ng-class as well as ng-style in the case of the center position. This should make sure that everyone who is using an own template is not disturbed by the default styles/classes. I tried to squash the commits and am not sure if I succeeded to achieve what you wanted. I am kind of new to Git so if that is not the expected outcome, then please tell me what to do :) |
Don't worry about squashing. I can do that when I merge. On the left/right/center styles, the $centerStyle field does help custom templates provide center styling but the management of the margins for left and right is still a black box that custom templates can't easily override or customize. If you instead use an ng-class by putting the position field on scope and doing the adding/setting of the left/right classes dependent on the value of the position attribute, then a custom template can change that very easily. Basically, try to have zero logic for the positioning in the JS code. Try to put it all in the template. Something like I've thought more about the events as well. I think the elegant solution is to emit events on the message scope rather than having these special onXXX properties of the notification itself. If you use $emit on the notification message scope, then the event will bubble up to the $rootScope. A user can put a listener on $rootScope and then they'd get events for all notifications. If they really only want to listen for events for one individual notification (probably less likely) they can send in a custom scope and put a listener only on that scope (or always keep a listener on $rootScope but just have code in the listener that filters out all but the notifications they care about). P.S. Working with large pull requests with many features can be difficult. If you'd like to make only a few of these changes you can create different branches in your repo for each separate feature and submit pull requests for each individual feature. That would allow me to merge individual features as they're ready instead of waiting for everything. Up to you though. |
Could this please be merged soon? |
I added the following functionality:
left
side of the screenright
side are now really on the most right position possible (with a tiny margin of course).notify()
with a duration option, which overwrites the configured duration for the single notification.!isUndefined()
was used in the code. As angular providesisDefined()
, I replaced it. Also there was an unused variablej
, which got incremented but never got used.position
can only be a string.notify()
-function.EDIT: I just saw that I made a mistake when configuring the position. No matter what you use as a parameter, the config remains at the center position. I will fix that as soon as I'm at my local machine :)
I would be happy to get some feedback :)