Skip to content

Instantly share code, notes, and snippets.

Template.ProjectForm.events({
'click .save':function(evt, tmpl) {
var name = tmpl.find('.name').value;
var client = tmpl.find('.client').value;
alert(name + ' ' + client);
},
'click .cancel': function(evt, tmpl) {
}
Template.ProjectForm.events({
'click .save':function(evt, tmpl) {
var name = tmpl.find('.name').value;
var client = tmpl.find('.client').value;
addProject(name, client);
Session.set('showProjectDialog', false);
},
'click .cancel': function(evt, tmpl) {
Session.set('showProjectDialog', false);
<template name="ProjectForm">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
<p>
<label for="name">Name:</label>
/* /server/utility.js */
Meteor.startup(function () {
Meteor.methods({
removeAllProjects:function() {
Projects.remove({});
}
});
});
Template.ProjectRow.events({
'dblclick .projectRow':function(evt,tmpl) {
alert(tmpl.data._id);
}
});
Session.setDefault('showProjectDialog', false);
Session.setDefault('editing_project', null);
/* i removed form events from this page to close modal as they should have been on project_form.js file */
Template.Projects.projectList = function() {
return Projects.find();
};
Template.Projects.showProjectDialog = function() {
return Session.get('showProjectDialog');
};
Template.Projects.events({
Template.ProjectForm.events({
'click .save':function(evt, tmpl) {
var name = tmpl.find('.name').value;
var client = tmpl.find('.client').value;
var status = tmpl.find('.status').value;
addProject(name, client, status);
Session.set('showProjectDialog', false);
Session.set('editing_project', null);
},
<template name="ProjectForm">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
{{#if editing_project}}
<h4 class="modal-title">Update Project</h4>
{{else}}
<h4 class="modal-title">Add Project</h4>
{{/if}}
<template name="ProjectForm">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
{{#if editing_project}}
<h4 class="modal-title">Update Project</h4>
{{else}}
<h4 class="modal-title">Add Project</h4>
{{/if}}