Created
November 19, 2015 07:14
-
-
Save bkuri/1c2852eceead363312d6 to your computer and use it in GitHub Desktop.
This is my version of the todo-riot tag in jade. Not sure if line 25 works or not, but I tried running without it (and without the script tag) and it still didn't work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks | |
task(each=data.tasks) | |
script(type='coffee') | |
@getMeteorData = -> | |
# If hide completed is checked filter tasks, otherwise return all of them | |
pattern = if (Session.get 'hideCompleted') then checked: $ne: yes else {} | |
tasks: (Tasks.find pattern, sort: createdAt: -1).fetch() | |
@mixin 'RiotMeteorData' | |
setChecked = (e) -> | |
item = e.item | |
Meteor.call 'setChecked', item._id, e.target.checked | |
setPrivate = (e) -> | |
item = e.item | |
Meteor.call 'setPrivate', item._id, (not item.private) | |
deleteTask = (e) -> | |
item = e.item | |
Meteor.call 'deleteTask', item._id | |
task | |
li(class='#{ "checked" if checked? } #{ "private" if private? }') | |
button.delete(onclick=parent.deleteTask) × | |
input.toggle-checked(type="checkbox" checked=checked onclick=parent.setChecked) | |
button.toggle-private(if='#{owner is Meteor.userId()}' onclick=parent.setPrivate) #{ if private then "Private" else "Public" } | |
span.text: strong #{username} - #{text} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment