12345678910111213141516171819202122232425262728293031 |
- /**
- * @file
- *
- *
- * User: marand
- * Date: 31/08/15
- * Time: 20:47
- */
- Template.postSubmit.events({
- 'submit form': function (e) {
- e.preventDefault();
- var post = {
- url: $(e.target).find('[name=url]').val(),
- title: $(e.target).find('[name=title]').val()
- };
- Meteor.call('postInsert', post, function (error, result) {
- // Display the error to the user and abort.
- if (error) {
- return alert(error);
- }
- if (result.postExists) {
- alert("This link has already been posted");
- }
- Router.go('postPage', { _id: result._id });
- });
- }
- });
|