12345678910111213141516171819202122232425262728293031 |
- /**
- * Client code for the website_form template.
- *
- * - events
- */
- Template.website_form.events({
- "click .js-toggle-website-form": function () {
- $("#website_form").toggle("slow");
- },
- "submit .js-save-website-form": function (event) {
- // here is an example of how to get the url out of the form:
- const url = event.target.url.value;
- const title = event.target.title.value;
- const description = event.target.description.value;
- let poster = {
- _id: Meteor.userId(),
- name: Meteor.user().username
- };
- const postDate = new Date();
- // put your website saving code in here!
- const doc = { url, title, description, poster, postDate };
- Meteor._debug("Client trying to insert", doc);
- Websites.insert(doc);
- // Stop the form submit from reloading the page
- return false;
- }
- });
|