-
Notifications
You must be signed in to change notification settings - Fork 48
Ports - Elle #35
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
base: master
Are you sure you want to change the base?
Ports - Elle #35
Conversation
…hen clicked. The button click makes a GET request and then each trip is added to a tr and displayed in the DOM.
…save point before I try having the trip list populate a ul instead of a table.
…n of function to make reservation. Need to bug fix.
…Added required keyword to HTML form to prevent unnecessary API calls. Added some comments on on items that still need attention.
…lso does not disappear.
… details to show - currently undefined. Still working on this.
…ed up a few comments.
…calls if Show All Trips button is clicked again.
…w. The form starts as hidden and will not flash during initial page load.
Made the same change on both branches.
… small refactor to remove a variable that seemed not-so-useful.
TREKWhat We're Looking For
|
| $("#trip-details").append(`<p><span class="bold">Summary:</span><br> ${trip.about}</p>`); | ||
| $("#trip-details").append(`<p><span class="bold">Price:</span> $${trip.cost.toFixed(2)}</p>`); | ||
|
|
||
| $('#reservation-form').unbind('submit'); |
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.
Very good idea to use unbind to remove other event handlers from the form.
|
|
||
| $(`#${trip.id}`).unbind() | ||
| $(`#${trip.id}`).bind('click', {thisTrip:trip}, function(event){ | ||
| // Chris: I realized when I was just about done with this project that .bind() is deprecated. D: This should be changed to a .on() method instead. I will refactor if I get some more time, or perhaps we could talk through it. |
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.
Yup, this still works fine, the better way is to use .on like we did in class.
| if (error.response.data && error.response.data.errors) { | ||
| reportStatus(`${customMessage} Details: ${error.message}, ${error.response.data.errors}`); | ||
| } else { | ||
| reportStatus(`${customMessage} Details: ${error.message}`); |
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 should respond by also reporting any validation errors. You can loop through the content like we did in Rails.
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions
Tripin the list by it's ID field. Would it be advantageous to keep the list in order by the id field? Explain why or why not.