Conversation
…ature (hover - bold text) over trips. Added On-click jquery method that is intended to be used for populating <ul> of trip details.
…s. New methods include: singleTripURL - path to API that requires trip id, loadTripdetails(), method that makes call to API with given trip ID passed in from click event, and .on() method that waits for a click event on the #all-trips list and passes in the list item to the loadTripdetails function.
…ption to toggle between viewing/not viewing a form. Added a form with a button to create a reservation. Buttons are currently not linked to API.
…ing - will refactor if theres time) form is displayed to user if they decide to purchase the currently viewed trip.
…ill be displayed a confirmation that a trip was reserved or an error message.
…yed error messages if they violate API input requirements.
…, cleaned up lines for index.js
|
|
||
| $(`#create-trip`).submit(createTrip); | ||
| $(document).on("click","#submit-trip",function(){ | ||
| $('#create-trip').toggle("slow") |
|
|
||
| $(document).on("click","#submit-button",function(event){ | ||
| $(`#submit-button`).toggle(); | ||
| $(`#book-trip-form`).append(`<button id="button-success" class="button success">Trip Booked!</button>`); |
There was a problem hiding this comment.
This always has a successful button, even if the reservation wasn't made correctly!
| .catch((error) => { | ||
| reportStatus('fail') | ||
| if( error.message && error.response.data.errors){ | ||
| let v = error.response.data.errors |
| console.log(v) | ||
| reportError(error.message,error.response.data.errors) | ||
| }else | ||
| reportError(`encounted error: ${error.message}`) |
There was a problem hiding this comment.
your formatting, indentation, and semicolons!
|
|
||
| let reserveAtrip = function(tripID){ | ||
| let singleURL =`` | ||
| return singleURL+= `https://ada-backtrek-api.herokuapp.com/trips/${tripID}/reservations` |
There was a problem hiding this comment.
you set the variable singleURL to an empty string, and then return it after concatenating a URL... isn't this the same as
let reserveAtrip = function(tripID){
return `https://ada-backtrek-api.herokuapp.com/trips/${tripID}/reservations`
}Also, camel case on this is a little off, I might call this function reserveTrip or reserveSingleTrip or something similar
TREKWhat We're Looking For
Fffffaaaancy jQuery work!!!! Looks good! Your code looks fine, except for a few comments I left and... you forgot semicolons at the end of lines all over the place! Particularly the lines where you appended a lot of HTML. Good work though! Good work on the optional of creating a trip, too. |
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions