Skip to content

Instantly share code, notes, and snippets.

@mplatts
Created Nov 18, 2014
Embed
What would you like to do?
events 5
# client/views/team.coffee
Template.team.helpers
editing: -> Session.get('editing') == @_id
Template.team.events
"click .edit": (e, tpl) ->
e.preventDefault()
Session.set('editing', @_id)
"submit form.form-edit": (e, tpl) ->
e.preventDefault()
teamName = tpl.$("input[name='name']").val()
if teamName.length
Teams.update(@_id, $set: {name: teamName})
Session.set('editing', null)
"click .cancel": (e, tpl) ->
e.preventDefault()
Session.set('editing', null)
"click .remove": (e, tpl) ->
e.preventDefault()
Teams.remove(@_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment