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.
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.
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.
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.
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.
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