-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.tag
47 lines (41 loc) · 1.29 KB
/
tasks.tag
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
<tasks>
<task each={data.tasks}/>
<script>
this.getMeteorData = function() {
var tasks;
if (Session.get("hideCompleted")) {
// If hide completed is checked, filter tasks
tasks = Tasks.find({checked: {$ne: true}}, {sort: {createdAt: -1}}).fetch();
} else {
// Otherwise, return all of the tasks
tasks = Tasks.find({}, {sort: {createdAt: -1}}).fetch();
}
return {
tasks: tasks
}
};
this.mixin('RiotMeteorData');
setChecked(e){
var item = e.item;
Meteor.call("setChecked", item._id, e.target.checked);
}
setPrivate(e){
var item = e.item;
Meteor.call("setPrivate", item._id, ! item.private);
}
deleteTask(e){
var item = e.item;
Meteor.call("deleteTask", item._id);
}
</script>
</tasks>
<task>
<li class="{ checked : checked } { private: private }">
<button class="delete" onclick={ parent.deleteTask }>×</button>
<input type="checkbox" checked="{checked}" onclick={ parent.setChecked } class="toggle-checked" />
<button if={ owner === Meteor.userId() } onclick={ parent.setPrivate } class="toggle-private">
{ private? "Private" : "Public" }
</button>
<span class="text"><strong>{username}</strong> - {text}</span>
</li>
</task>