Skip to content

Commit

Permalink
adding support for a click handler on 'growl' notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikJoreteg committed Feb 6, 2012
1 parent a086dc9 commit 2c2f896
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build/ui.js
Expand Up @@ -1115,6 +1115,24 @@ Notification.prototype.remove = function(){
this.el.remove();
return this;
};

/**
* Enable a click callback.
*
* @return {Notification} for chaining
* @api public
*/

Notification.prototype.click = function(fn){
var self = this;
this.el.click(function(e){
e.preventDefault();
e.stopPropagation();
self.hide();
fn && fn();
});
return this;
};
})(ui, "<li class=\"notification hide\">\n <div class=\"content\">\n <h1>Title</h1>\n <a href=\"#\" class=\"close\">×</a>\n <p>Message</p>\n </div>\n</li>");
;(function(exports, html){

Expand Down
18 changes: 18 additions & 0 deletions lib/components/notification/notification.js
Expand Up @@ -226,4 +226,22 @@ Notification.prototype.hide = function(ms){
Notification.prototype.remove = function(){
this.el.remove();
return this;
};

/**
* Enable a click callback.
*
* @return {Notification} for chaining
* @api public
*/

Notification.prototype.click = function(fn){
var self = this;
this.el.click(function(e){
e.preventDefault();
e.stopPropagation();
self.hide();
fn && fn();
});
return this;
};

0 comments on commit 2c2f896

Please sign in to comment.