Skip to content

Commit

Permalink
Sorted out the supposed nested partial bug, in reality it was a problem
Browse files Browse the repository at this point in the history
with matador trying to load swp files in place of the actual files
  • Loading branch information
lashleigh committed Jan 19, 2012
1 parent a7b0cae commit 1763005
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
22 changes: 11 additions & 11 deletions app/controllers/RecipeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = require(app.set('controllers') + '/ApplicationController').exte
this.getModel('Recipe').index(
function(num, recipes) {
control.render('index', {
title: 'balls',
count: num,
recipes: recipes
})
Expand All @@ -15,11 +16,6 @@ module.exports = require(app.set('controllers') + '/ApplicationController').exte
console.log(err)
}
)
/*this.render('index', {
count: 12,
recipes: [{title: 'thing', stuff: [{amount: 50, name: 'flour'}, {amount: 100, name: 'water'}, {amount: 1.2, name: 'salt'}]},
{title: 'bings', stuff: [{amount: 20, name: 'wheat'}, {amount: 72, name: 'water'}, {amount: 0.6, name: 'salt'}]}]
})*/
},
new: function() {
this.render('new', {
Expand All @@ -33,10 +29,14 @@ module.exports = require(app.set('controllers') + '/ApplicationController').exte
})
this.response.redirect('/recipe')
},
show: function () {
this.render('show', {
title: 'pi',
stuff: [{amount: 50, name: 'flour'}, {amount: 100, name: 'water'}, {amount: 1.2, name: 'salt'}]
})
}
show: function (id) {
var control = this
this.getModel('Recipe').show(id,
function(recipe) {
control.render('show', {recipe: recipe})
},
function() {

})
}
})
10 changes: 7 additions & 3 deletions app/models/RecipeModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ module.exports = require(app.set('models') + '/ApplicationModel').extend(functio
findAll: function() {
this.DBModel.find()
},
show: function(id, success, failure) {
this.DBModel.findById(id, function(err, res) {
console.log(id, res)
success(res)
})
},
index: function(success, failure) {
console.log('should be counting')
var count
var recipes
this.DBModel.count({}, function(err, docs) {
count = docs
console.log(err, docs, 'docs')
})
this.DBModel.find({}, function(err, docs) {
recipes = docs
this.DBModel.find({}, function(err, recipes) {
success(count, recipes)
})
}
Expand Down
8 changes: 2 additions & 6 deletions app/views/recipe/partials/recipe.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
<h1>Here is a recipe called {{title}}</h1>
<ul>
{{#stuff}}
<li>{{amount}} grams {{name}}</li>
{{/stuff}}
</ul>
<a href="recipe/{{_id}}"><h1>Here is a recipe called {{title}}</h1></a>
{{>ingredients}}
4 changes: 3 additions & 1 deletion app/views/recipe/show.html
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{> recipe}}
{{#recipe}}
{{>recipe}}
{{/recipe}}

0 comments on commit 1763005

Please sign in to comment.