Last active
August 29, 2015 14:10
-
-
Save mplatts/429f8a32acb48c25fef5 to your computer and use it in GitHub Desktop.
templates2 - create game method
This file contains hidden or 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
# client/views/games.coffee | |
Template.games.helpers | |
teams: Teams.find() | |
games: Games.find() | |
creating: -> Session.get 'creating-game' | |
Template.games.events | |
"click .create": (e, tpl) -> | |
e.preventDefault() | |
Session.set 'creating-game', true | |
"click .cancel": (e, tpl) -> | |
e.preventDefault() | |
Session.set 'creating-game', null | |
"submit form.form-create": (e, tpl) -> | |
e.preventDefault() | |
teamOneId = tpl.$("select[name='teamOne']").val() | |
teamTwoId = tpl.$("select[name='teamTwo']").val() | |
Meteor.call 'gamesInsert', teamOneId, teamTwoId, (error, id) -> | |
if error | |
return alert error.error | |
Session.set 'creating-game', false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment