Conversation
public/scripts/app.js
Outdated
| }); | ||
|
|
||
|
|
||
|
|
| @@ -8,8 +8,6 @@ body { | |||
|
|
|||
| message: "Welcome to BJJ reviews!", | ||
| description: "This is a app that allows people to read reviews on Brazilian Jiu Jitsu Academy", | ||
| documentation_url: "https://github.com/breese8009/express-personal-api", | ||
| base_url: "localhost:4000", |
mnfmnfm
left a comment
There was a problem hiding this comment.
Overall looks good--I wish you'd been able to get edit working.
| @@ -0,0 +1,55 @@ | |||
|
|
|||
There was a problem hiding this comment.
file name should just be bjjController.js, singular
| console.log('body', req.body); | ||
|
|
||
|
|
||
| db.Bjj.create(req.body, function(err, reviews) { |
There was a problem hiding this comment.
This gives back a singular, not a plural, so should probably have the variable name review rather than reviews
| function show(req, res) { | ||
| // find one gym by id and send it back as JSON | ||
| console.log(req.params.bjjId); | ||
| db.Bjj.findById(req.params.bjjId, function(err, foundAlbum) { |
|
|
||
| var bjjHtml = (` | ||
|
|
||
| <div class="container forms" data-bjj='${bjj._id}'> |
There was a problem hiding this comment.
this should be indented to reflect HTML structure.
| @@ -1,15 +1,8 @@ | |||
| // This file allows us to seed our application with data | |||
| // simply run: `node seed.js` from the root of this project folder. | |||
|
|
|||
There was a problem hiding this comment.
seed files are useful! please write them!
| <!-- gym data display div --> | ||
|
|
||
| <div id="gymDisplay"></div> | ||
| <!-- <div class="container"> |
There was a problem hiding this comment.
this much commented out code is usually a bad sign--better to take it out of this file entirely.
| $.ajax({ | ||
| method:"DELETE", | ||
| url: '/api/bjj/'+currentBjjId, | ||
| success: currentBjjElem.remove() |
There was a problem hiding this comment.
This removes that element immediately, not as a callback! It'll remove from the page whether or not the API call is successful. It should instead be:
success: function() {
currentBjjElem.remove();
}| <div class="container forms" data-bjj='${bjj._id}'> | ||
| <div class="row"> | ||
| <div class="col-sm-12"> | ||
| <div class="card" style="width: 75%;"> |
There was a problem hiding this comment.
manually setting width is so sad! could add another class so you can still use class-based styling for these cards.
|
|
||
| // loop through data and render to html | ||
| function renderMultipleReviews(reviews) { | ||
| console.log(reviews); |
| e.preventDefault(); | ||
| var formData = $(this).serialize(); | ||
| console.log('formData', formData); | ||
| $.post('/api/bjj', formData).done(renderMultipleReviews); |
There was a problem hiding this comment.
odd that you're using
Reviews site