Created
May 12, 2014 00:46
-
-
Save kingluddite/dd149d28ec8d63380485 to your computer and use it in GitHub Desktop.
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 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">×</button> | |
<h4 class="modal-title">Modal title</h4> | |
</div> | |
<div class="modal-body"> | |
<p> | |
<label for="name">Name:</label> | |
<input type="text" name="name" class="input form-control name" value="{{project.name}}"> | |
</p> | |
<label for="client">Client:</label> | |
<input type="text" name="client" class="input form-control client" value="{{project.client}}"> | |
<select name="status" class="status"> | |
<option value="OnHold">On Hold</option> | |
<option value="Active">Active</option> | |
</select> | |
</div> | |
<div class="modal-footer"> | |
<button type="button" class="btn btn-default cancel" data-dismiss="modal">Close</button> | |
<button type="button" class="btn btn-primary save">Save changes</button> | |
</div> | |
</div><!-- /.modal-content --> | |
</div><!-- /.modal-dialog --> | |
</template> |
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.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); | |
}, | |
'click .cancel': function(evt, tmpl) { | |
Session.set('showProjectDialog', false); | |
} | |
}); | |
var addProject = function(name, client, status) { | |
Projects.insert({name: name, client: client, status: status}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment