Skip to content
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

pipes | tanisha | backtrek #28

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8af0d27
add underscore template
tanham Nov 28, 2017
dcaa748
add trip model
tanham Nov 28, 2017
83bf6d5
add trips api to collection
tanham Nov 28, 2017
9fd5d5b
set up app.js
tanham Nov 28, 2017
a162f82
add table =
tanham Nov 28, 2017
7bcc69e
add functionality to display trips
tanham Nov 29, 2017
a622920
add on click event
tanham Nov 29, 2017
51132eb
add template for indivdual trip view
tanham Dec 1, 2017
c5506bb
add urlRoot and toString override
tanham Dec 1, 2017
0c1e94b
update selector names
tanham Dec 1, 2017
3f828b4
whitespace
tanham Dec 1, 2017
8ad54c6
add renderTrip function
tanham Dec 1, 2017
ff5e9c5
fix typo
tanham Dec 1, 2017
f1de288
update toString override
tanham Dec 1, 2017
5071412
add trip event handler to renderTrips function
tanham Dec 1, 2017
3ae45d6
add about attribute to undersroce template
tanham Dec 1, 2017
3e12509
update urlRoot
tanham Dec 2, 2017
9fbade4
fetch trip details from within trips loop
tanham Dec 2, 2017
6564173
add form
tanham Dec 2, 2017
a058ee6
update form
tanham Dec 2, 2017
67c2362
add functions to read and save form data
tanham Dec 2, 2017
d7fe793
remove comments
tanham Dec 2, 2017
e2a350f
add functionality to remove trip from list if it does not save
tanham Dec 2, 2017
36a69f7
add reserve link trip-template
tanham Dec 2, 2017
f6a222e
add reserve form template
tanham Dec 2, 2017
a7aded4
compile underscore template
tanham Dec 2, 2017
bce8b3b
fix typo
tanham Dec 2, 2017
e9e9abc
add functionality to sort by trip fields
tanham Dec 4, 2017
4728d1d
add click handler to renderTrip function
tanham Dec 4, 2017
bd75324
add reservation model
tanham Dec 4, 2017
e73178a
add error handling
tanham Dec 4, 2017
f8085fc
add toggle
tanham Dec 4, 2017
0222761
remove unneeded class
tanham Dec 4, 2017
bd4186b
add comment
tanham Dec 4, 2017
d937594
update error handling
tanham Dec 4, 2017
27c6bd8
update styling
tanham Dec 4, 2017
d15006b
add comment
tanham Dec 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add click handler to renderTrip function
  • Loading branch information
tanham committed Dec 4, 2017
commit 4728d1dd934df87e9bca09f822abbe258be4a346
1 change: 1 addition & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
<main>
<a href="#" id="trips">see trips</a>
<aside id="trip"></aside>
<aside id="reserve-form"></aside>

<section class="columns large-4 small-12">
<h2>Add a Trip</h2>
16 changes: 13 additions & 3 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -34,25 +34,34 @@ const renderTrips = function renderTrips(list) {
success: function(trip) {
console.log('worked');
renderTrip(trip);

},
error: function(message, b) {
console.log(message, b);
}
}); // end of fetch

})
tripTableElement.append(generatedHTML);
});
};

const renderReserve = function renderReserve() {
const reserveForm = $('#reserve-form');
reserveForm.html('');
const generatedHTML = reserveTemplate();
console.log(generatedHTML);
reserveForm.append(generatedHTML);
}

const renderTrip = function renderTrip(trip) {
const tripElement = $('#trip');
// clears html in tripElement
tripElement.html('');
const generatedHTML = tripTemplate(trip.attributes);
tripElement.append(generatedHTML);

$('#reserve').on('click', (event) => {
renderReserve();
});
}

$('th.sort').removeClass('current-sort-field');
@@ -109,11 +118,12 @@ const renderTrips = function renderTrips(list) {
renderTrips(tripList);
}); // end tripsList event handler



$('#add-trip-form').on('submit', addTripHandler);

TRIP_FIELDS.forEach((field) => {
const headerElement = $(`th.sort.${field}`);
console.log(headerElement);
headerElement.on('click', (event) => {
console.log(`sorting table by ${field}`);
tripList.comparator = field;