-
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
Lauren Cardella -- Carets #42
base: master
Are you sure you want to change the base?
Conversation
…. Add basic HTML structure. Build loadTrips() function to retrieve trip collection. Build Trip model and TripList Collection.
…he about attribute to be recognized within the template.
… for visual feedback.
… Add client-side validations for new trip. Set up error handling.
BackTREKWhat We're Looking For
|
src/app.js
Outdated
updateStatusMessageFrom(trip.validationError); | ||
} | ||
|
||
tripList.fetch(); |
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.
This fetch
will be run before the trip finishes saving and thus the new trip may not show up in the tripList.
|
||
const successfulSave = function(trip, response) { | ||
updateStatusMessagesWith(`${trip.get('name')} added!`) | ||
clearForm(); |
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.
This is where you should have the tripList
refresh, or fetch the trip's name and manually add it to the list.
src/app/models/trip.js
Outdated
import Backbone from 'backbone'; | ||
|
||
const Trip = Backbone.Model.extend({ | ||
url: function() { |
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.
As I said earlier, you could also replace this url
function with:
urlRoot: https://ada-backtrek-api.herokuapp.com/trips/
urlRoot is the endpoint that the API begins and Backbone can infer RESTful routes from there.
src/app.js
Outdated
$('#reservation').hide(); | ||
clearForm(); | ||
}).fail(() => { | ||
$('#message').html('<p>Reservation failed to save.</p>'); |
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.
You really should have some client-side validations, just if statements checking to make sure the form fields have valid values.
src/app.js
Outdated
tripListElement.append(tripTemplate(trip.attributes)); | ||
}); | ||
|
||
$('th.sort').removeClass('current-sort-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.
What about if it's already sorted by this field? How could you then reverse the order?
…t on next click. Filter clears on resort.
…ith urlRoot in trip.
Hi Chris, I added filtering capabilities and made the suggested edits. The filtering doesn't quite work the way it should--if I sort a filtered list it removes the filtering and shows the entire list again. |
BackTREK
Congratulations! You're submitting your assignment!
Comprehension Questions