Permalink
Browse files

add project form

  • Loading branch information...
1 parent 57b5f06 commit 89d8595e081044c350300b6497ad4da982e35406 @theresaanna committed May 8, 2012
Showing with 28 additions and 48 deletions.
  1. +6 −11 client/addProject.js
  2. +15 −35 goalie.html
  3. +7 −2 goalie.js
View
@@ -1,17 +1,12 @@
-Template.addProjectLink.events = {
+Template.addProject.events = {
'click #addProjectSubmit': function(e) {
e.preventDefault();
-
- var name = $('[name="projectName"]').attr('value'),
- formMilestones = $('[name="milestone"]').attr('value'),
- formTasks = $('[name="task"]').attr('value');
-
- $(formTasks).each(function() {
- console.log(this);
- });
-
- },
+ var projName = document.getElementById('newProjectName').value;
+ Project.insert({ name: projName });
+ }
+};
+Template.addProjectLink.events = {
'click .expand': function(e) {
e.preventDefault();
$('.expandable').toggle();
View
@@ -17,22 +17,26 @@
<template name="project">
<div class="project">
<h1>{{name}}</h1>
- <div class="milestones">
- {{#each milestones}}
- {{> milestones}}
- {{/each}}
- </div>
+ {{#if milestones}}
+ <div class="milestones">
+ {{#each milestones}}
+ {{> milestones}}
+ {{/each}}
+ </div>
+ {{/if}}
</div>
</template>
<template name="milestones">
<div class="milestone">
<h2>{{name}}</h2>
- <div class="tasks">
- {{#each tasks}}
- {{> tasks}}
- {{/each}}
- </div>
+ {{#if tasks}}
+ <div class="tasks">
+ {{#each tasks}}
+ {{> tasks}}
+ {{/each}}
+ </div>
+ {{/if}}
</div>
</template>
@@ -55,31 +59,7 @@
<template name="addProject">
<div id="addProject">
<form>
- <input type="text" value="Project Name" name="projectName"></input>
- <fieldset id="milestones">
- <legend>Milestones</legend>
- <input type="text" value="Milestone" name="milestone">
- <fieldset id="tasks">
- <legend>Tasks</legend>
- <input type="text" value="Task" name="task"/>
- <input type="text" value="Task" name="task"/>
- <input type="text" value="Task" name="task"/>
- </fieldset>
- <input type="text" value="Milestone" name="milestone">
- <fieldset id="tasks">
- <legend>Tasks</legend>
- <input type="text" value="Task" name="task"/>
- <input type="text" value="Task" name="task"/>
- <input type="text" value="Task" name="task"/>
- </fieldset>
- <input type="text" value="Milestone" name="milestone">
- <fieldset id="tasks">
- <legend>Tasks</legend>
- <input type="text" value="Task" name="task"/>
- <input type="text" value="Task" name="task"/>
- <input type="text" value="Task" name="task"/>
- </fieldset>
- </fieldset>
+ <input type="text" value="Project Name" name="projectName" id="newProjectName"></input>
<input type="submit" id="addProjectSubmit" value="Add project"/>
</form>
</div>
View
@@ -9,8 +9,13 @@ if (Meteor.is_client) {
Template.project.milestones = function() {
var milestones = this.milestones;
- return Milestone.find({_id: {$in: milestones}});
- };
+ if (typeof milestones !== 'undefined') {
+ return Milestone.find({_id: {$in: milestones}});
+ }
+ else {
+ return null;
+ }
+ };
Template.milestones.tasks = function() {
// minimongo dot notation doesn't seem to be working on 0.3.5 either

0 comments on commit 89d8595

Please sign in to comment.