-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflash-notifications-ui.js
68 lines (63 loc) · 1.61 KB
/
flash-notifications-ui.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* global lookup, FlashNotificationCollection */
Template.flashNotifications.helpers({
items: function() {
return lookup("FlashNotifications", this).find();
}
});
Template._flashNotificationsItem.events({
click: function(e, t) {
if (!this.pinned) {
lookup("FlashNotifications", t.data).remove({_id: this._id});
}
},
"click [data-action]": function() {
if (this.onclick) {
this.onclick(this);
}
}
});
Template.flashNotifications.tests = {
basic: function() {
var collection = new FlashNotificationCollection();
var data = [
{
title: "Blocked",
description: "George Halpert",
pinned: true, feeling: "negative", icon: "flag",
actionLink: {
classes: "undo inverse",
onclick: function() {
/*eslint-disable no-alert*/
alert("clicked");
/*eslint-enable no-alert*/
},
text: "Undo"
}
},
{
title: "Invited",
description: "20 students were invited",
pinned: true, feeling: "positive", icon: "email"
},
{
title: "Update now",
description: "Don\"t forget to save your work",
pinned: true, feeling: "neutral", icon: "download", actionLink: {
classes: "undo inverse",
text: "Update"
}
},
{
title: "Connecting",
description: "Test: Trying to connect to server",
pinned: true, feeling: "neutral", icon: "sync"
}
];
_.each(data, function(d) {
collection.add(d);
});
return {
FlashNotifications: collection
};
}
};