-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Carets - Maria - BackTrek #37
base: master
Are you sure you want to change the base?
Conversation
…trips appending to the all trips
BackTREKWhat We're Looking For
|
|
||
$('h3').text('Trip Info'); | ||
|
||
trip.fetch().done(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no detecting that the fetch
failed, so no way to provide a msg about when things fail.
|
||
const loadTrips = function loadTrips() { | ||
tripList.fetch(); | ||
tripList.on('update', render, tripList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's theoretically possible that the fetch could complete before the update
event listener is added. So I would register the listener in $(document).ready
when the application starts.
This will also register render
as an event listener every time loadTrips
is clicked, so the list could be rendered multiple times.
event.preventDefault(); | ||
|
||
const tripData = {}; | ||
fields.forEach((field) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking this into a helper method which reads the form would be better.
console.log(response); | ||
$('#status-messages ul').empty(); | ||
$('#status-messages ul').append(`<li>${trip.get('name')} added!</li>`); | ||
$('#status-messages').show(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also clear the form on a successful save.
BackTREK
Congratulations! You're submitting your assignment!
Comprehension Questions