Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

I wanted this for my use case, thought it may be useful to others. #29

Merged
merged 2 commits into from

2 participants

@HenrikJoreteg

If you don't want it, or wanna do it differently, no worries.

@tj
Owner
tj commented

we have .closable() which emits an event

@HenrikJoreteg
@tj
Owner
tj commented

ah I see, I've never clicked a growl notification before. I guess we could just have .on('click' though even from a UX point of view that's not obvious IMO, a link in the notification or something would be better

@HenrikJoreteg

Well, I agree from a UX perspective that it may not be obvious, but part of that depends on how the notifications are styled. I've got a web app that use Growl if available (if running as a Fluid app or desktop-wrapped app) and I'm planning on using UI kit notifications as a fallback for that. So for me, it's be great if I could supply similar options.

I agree with what you're saying using the .on('click') api. I updated the pull request.

Anyway, I can just do what I've already done, but I think it'd be cool if this behavior (in some form) existed in the lib itself. Cheers!

@tj
Owner
tj commented

cool thanks I'll take the updated version

@tj tj merged commit 8358a21 into tj:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 0 deletions.
  1. +11 −0 build/ui.js
  2. +11 −0 lib/components/notification/notification.js
View
11 build/ui.js
@@ -965,6 +965,7 @@ exports.error = type('error');
*/
function Notification(options) {
+ ui.Emitter.call(this);
options = options || {};
this.template = html;
this.el = $(this.template);
@@ -972,6 +973,11 @@ function Notification(options) {
if (Notification.effect) this.effect(Notification.effect);
};
+/**
+ * Inherit from `Emitter.prototype`.
+ */
+
+Notification.prototype = new ui.Emitter;
/**
* Render with the given `options`.
@@ -991,6 +997,11 @@ Notification.prototype.render = function(options){
return false;
});
+ el.click(function(e){
+ e.preventDefault();
+ self.emit('click', e);
+ });
+
el.find('h1').text(title);
if (!title) el.find('h1').remove();
View
11 lib/components/notification/notification.js
@@ -77,6 +77,7 @@ exports.error = type('error');
*/
function Notification(options) {
+ ui.Emitter.call(this);
options = options || {};
this.template = html;
this.el = $(this.template);
@@ -84,6 +85,11 @@ function Notification(options) {
if (Notification.effect) this.effect(Notification.effect);
};
+/**
+ * Inherit from `Emitter.prototype`.
+ */
+
+Notification.prototype = new ui.Emitter;
/**
* Render with the given `options`.
@@ -103,6 +109,11 @@ Notification.prototype.render = function(options){
return false;
});
+ el.click(function(e){
+ e.preventDefault();
+ self.emit('click', e);
+ });
+
el.find('h1').text(title);
if (!title) el.find('h1').remove();
Something went wrong with that request. Please try again.