From 1c276e04e6958508bfab9ce71e91cbeb07593aae Mon Sep 17 00:00:00 2001 From: Hannah Cameron Date: Tue, 22 May 2018 19:24:38 -0700 Subject: [PATCH 1/9] started project - added in empty files --- index.css | 0 index.html | 0 index.js | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 index.css create mode 100644 index.html create mode 100644 index.js diff --git a/index.css b/index.css new file mode 100644 index 00000000..e69de29b diff --git a/index.html b/index.html new file mode 100644 index 00000000..e69de29b diff --git a/index.js b/index.js new file mode 100644 index 00000000..e69de29b From 81ac185a49c979a6f70916727f850bd16bf0b992 Mon Sep 17 00:00:00 2001 From: Hannah Cameron Date: Tue, 22 May 2018 19:54:40 -0700 Subject: [PATCH 2/9] added in framework for loadTrips; added in load trips button --- index.html | 24 ++++++++++++++++++++++++ index.js | 20 ++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/index.html b/index.html index e69de29b..83f1466c 100644 --- a/index.html +++ b/index.html @@ -0,0 +1,24 @@ + + + + + + + +
+

Welcome to Trek - The new tech start up that's bound to disrupt the industry!

+
+ +
+
+ +
    +
    +
    + + + + + + diff --git a/index.js b/index.js index e69de29b..c94aa2fd 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,20 @@ + + +const loadTrips = () => { + const tripList = $('#tripa-list'); + tripList.empty(); + axios.get(URL) + .then((response) => { + + }) + .catch((error) => { + + }); +}; + + + + +$(document).ready (() => { + $('#trips-button').click(loadTrips); +}); From 26a2ef0c09e53b776d4dd50dc225fb7078aa84bd Mon Sep 17 00:00:00 2001 From: Hannah Cameron Date: Tue, 22 May 2018 20:10:17 -0700 Subject: [PATCH 3/9] passing wave one - clicking button shows list of trips --- index.html | 2 +- index.js | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 83f1466c..5bb0df8f 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@

    Welcome to Trek - The new tech start up that's bound to disrupt the industry
    -
      +
        diff --git a/index.js b/index.js index c94aa2fd..f4bb7fcf 100644 --- a/index.js +++ b/index.js @@ -1,20 +1,27 @@ - +const URL = "https://ada-backtrek-api.herokuapp.com/trips" const loadTrips = () => { - const tripList = $('#tripa-list'); + const tripList = $('#trips-list'); tripList.empty(); axios.get(URL) - .then((response) => { - - }) - .catch((error) => { - + .then((response) => { + const tripCollection = response.data + console.log(response); + tripCollection.forEach((trip) => { + console.log(trip); + tripList.append(`
      • ${trip.name}
      • `) }); + }); + // .catch((error) => { + // + // }); }; + $(document).ready (() => { $('#trips-button').click(loadTrips); + // loadTrips() }); From 70479783a577675f98d19910c5807448fcef75d2 Mon Sep 17 00:00:00 2001 From: Hannah Cameron Date: Tue, 22 May 2018 20:18:07 -0700 Subject: [PATCH 4/9] added in user messaging --- index.html | 1 + index.js | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 5bb0df8f..286ba771 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,7 @@

        Welcome to Trek - The new tech start up that's bound to disrupt the industry
        +
          diff --git a/index.js b/index.js index f4bb7fcf..301b5f3d 100644 --- a/index.js +++ b/index.js @@ -1,20 +1,27 @@ const URL = "https://ada-backtrek-api.herokuapp.com/trips" +const userMessage = (message) => { + $('#user-message').html(message) +} + const loadTrips = () => { const tripList = $('#trips-list'); tripList.empty(); + userMessage('Loading in trips..') axios.get(URL) .then((response) => { const tripCollection = response.data - console.log(response); + // console.log(response); tripCollection.forEach((trip) => { - console.log(trip); + // console.log(trip); tripList.append(`
        • ${trip.name}
        • `) }); + userMessage(`Showing ${tripCollection.length} amazing trips to choose from!`) + }) + .catch((error) => { + userMessage(`Hrmm.. something has gone wrong: ${error.message}`) + console.log(error); }); - // .catch((error) => { - // - // }); }; From 2894f4f60566bd00238ad88c9ac07982f7e268a2 Mon Sep 17 00:00:00 2001 From: Hannah Cameron Date: Tue, 22 May 2018 21:39:31 -0700 Subject: [PATCH 5/9] working on loadClickedTrip functionality --- index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 301b5f3d..d55ff239 100644 --- a/index.js +++ b/index.js @@ -13,8 +13,8 @@ const loadTrips = () => { const tripCollection = response.data // console.log(response); tripCollection.forEach((trip) => { - // console.log(trip); - tripList.append(`
        • ${trip.name}
        • `) + console.log(trip); + tripList.append(`
        • ${trip.name}
        • `) }); userMessage(`Showing ${tripCollection.length} amazing trips to choose from!`) }) @@ -24,11 +24,21 @@ const loadTrips = () => { }); }; - +function loadClickedTrip(trip) { + console.log(trip); + +} $(document).ready (() => { $('#trips-button').click(loadTrips); - // loadTrips() + $('.trip').click(function(){ + let trip = $(this) + loadClickedTrip(trip); + }) }); +// $(".note").click(function(){ +// let note = $(this).html(); +// playNote (note); +// }) From 3326e4c92a207c76c64cb44435dae76ababe8e93 Mon Sep 17 00:00:00 2001 From: Hannah Cameron Date: Wed, 23 May 2018 11:29:01 -0700 Subject: [PATCH 6/9] finished loadclickedtrip function - displaying all info for selected trip --- index.html | 2 ++ index.js | 31 +++++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 286ba771..b122053b 100644 --- a/index.html +++ b/index.html @@ -15,6 +15,8 @@

          Welcome to Trek - The new tech start up that's bound to disrupt the industry

            +
            +
            diff --git a/index.js b/index.js index ee1d5908..2f65bfc8 100644 --- a/index.js +++ b/index.js @@ -55,7 +55,7 @@ const buildForm = (selectedTrip) => { $('#trip-booking').empty(); $("#trip-booking").append('

            Book A Trip!

            ') $("#trip-booking").append( - `

            Trip: ${selectedTrip.name}

            Name:

            Email:

            ` + `

            Trip: ${selectedTrip.name}

            Name:

            Email:

            ` ) }