Last active
January 2, 2016 15:48
-
-
Save dillongreen/8325484 to your computer and use it in GitHub Desktop.
rather than jusing jQuery etc. one can use a template instance method such as find http://docs.meteor.com/#template_find
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
Template.application_security.events({ | |
"click #requirementAdd": function (evt, templ) { | |
var requirement = templ.find("#requirementText").value; | |
var motivation = templ.find("#motivationText").value; | |
var example = templ.find("#exampleText").value; | |
var technology = templ.find("#technologyText").value; | |
Requirements.insert({ | |
requirement: requirement, | |
motivation: motivation, | |
example: example, | |
technology: technology, | |
votes: 0, | |
email: getCurrentEmail(), | |
upvoters: [Meteor.userId()] | |
}); | |
}, | |
"click .upvote": function (evt, templ) { | |
Requirements.update(this._id, { | |
$inc: {votes: 1}, | |
$addToSet: {upvoters: Meteor.userId()} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment