Summary goes here
+name | +id | +continent | +category | +weeks | + + + +
---|
Hello World!
'); + tripTemplate = _.template($('#trip-template').html()); + infoTemplate = _.template($('#info-template').html()); + loadTrips(); + $('.all-trips').on('click', function() { + $('table').toggleClass('active'); + }); + + $('#trip-list').on('click', '.trip', function(){ + let tripID = $(this).attr('data-id'); + loadTripDetails(tripID); + $('#summary').get(0).scrollIntoView(); + }); + + $('.add').on('click', function(){ + $('#add-trip-form').toggle({'display': 'block'}); + }); + + $('#add-trip-form').submit(events.addTrip); + +// $('#add-reservation-form').submit( function(e { +// e.preventDefault(); +// console.log('when you click submit...'); +// console.log(this); +// let tripId = $(this).attr('data-id'); +// +// const url = `https://ada-backtrek-api.herokuapp.com/trips/${tripId}/reservations`; +// const formData = $(this).serialize(); +// +// $.post(url, formData, (response) => { +// $('#status-messages ul').append('Spot reserved!
'); +// console.log(response); +// document.getElementById("new-trip-form").reset(); +// }).fail(() => { +// $("#message").html("Unable to complete reservation
") +// }); +// }); +$(document).on('submit', '#add-reservation-form', events.addReservation) + + }); diff --git a/src/app/collections/trip_list.js b/src/app/collections/trip_list.js new file mode 100644 index 0000000..d79c1eb --- /dev/null +++ b/src/app/collections/trip_list.js @@ -0,0 +1,11 @@ +import Backbone from 'backbone'; +import Trip from '../models/trip'; + +const TripList = Backbone.Collection.extend({ + model: Trip, + url: 'https://ada-backtrek-api.herokuapp.com/trips', + + +}); + +export default TripList; diff --git a/src/app/models/reservation.js b/src/app/models/reservation.js new file mode 100644 index 0000000..6962f92 --- /dev/null +++ b/src/app/models/reservation.js @@ -0,0 +1,12 @@ +import Backbone from 'backbone'; + +const Reservation = Backbone.Model.extend({ + initialize: function(attributes) { + console.log('attributes here:'); + console.log(attributes); + }, + // idAttribute: 'id', + // urlRoot: 'https://ada-backtrek-api.herokuapp.com/trips/', +}); + +export default Reservation; diff --git a/src/app/models/trip.js b/src/app/models/trip.js new file mode 100644 index 0000000..0cf9da1 --- /dev/null +++ b/src/app/models/trip.js @@ -0,0 +1,8 @@ +import Backbone from 'backbone'; + +const Trip = Backbone.Model.extend({ + idAttribute: 'id', + urlRoot: 'https://ada-backtrek-api.herokuapp.com/trips/', +}); + +export default Trip; diff --git a/src/css/style.css b/src/css/style.css index b7b2d44..95878b8 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -1,2 +1,71 @@ +body { + height: 100vh; + margin: 0; + padding: 0; + background: #FDD02C; +} +img { + height: 20px; +} +h1 { + text-align: center; +} +li { + /*display: inline;*/ + /*list-style: circle url("http://www.pvhc.net/img223/xeiwtpbbgpmyhtcnjvwt.png");*/ +} +table { + display: none; +} +.active { + display: block; -/* Your styles go here! */ +} +table.active { + height: 90%; + position: static; + overflow: scroll; +} + +button { + /*font-size: 3em;*/ + /*padding: 20px;*/ +} +.row { + /*height: 800px;*/ + +} +.trips-table { + + background: #B0C13E; + /*padding: 20px;*/ + /*padding-top: 30px;*/ + height: 800px; + text-align: center; +} +#summary { + background: #4EAD6E; + + overflow: scroll; + height: 800px; + align-items: center; + +} +.info { + /*padding: 5px;*/ + /*height: 100%;*/ + /*overflow: scroll;*/ + background: #FD4B5C; +} +.info p { + /*padding: 10px;*/ +} +.add-trip { + background: #F4A927; +} +#add-trip-form { + display: none; +} +/*#status-messages li { + list-style: circle; +}*/