From 5e5d0cd030741593cd5e7c25fa9bf6a3d14a4209 Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Tue, 23 May 2017 15:23:05 -0700 Subject: [PATCH 01/17] got the names of the trips to show up --- index.html | 14 ++++++++++++++ trek.js | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 index.html create mode 100644 trek.js diff --git a/index.html b/index.html new file mode 100644 index 00000000..366a8f7f --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + + + + +
+ + + diff --git a/trek.js b/trek.js new file mode 100644 index 00000000..f60328b9 --- /dev/null +++ b/trek.js @@ -0,0 +1,25 @@ +var url = 'https://trektravel.herokuapp.com/trips'; + +var successCallback = function(response) { + console.log("Success!") + console.log(response); + + var target = $('#trips'); + for (var i = 0; i < response.length; i++) { + trip = response[i]; + target.append("
  • " + trip['name'] + "
  • "); + } +} + +var failureCallback = function() { + console.log("Didn't work"); + $("#errors").html("

    AJAX request failed!

    "); +} + +var clickHandler = function() { + $.get(url, successCallback) //passing a function around as a variable (to be invoted later.) when the request comes in, that is when it willb e called. +}; +//as soon as the document is ready, load the page +$(document).ready(function() { + $('#load').click(clickHandler); +}); From a0b17fdfeedfc7a89d5e4d7d4711260a91a9d957 Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Tue, 23 May 2017 15:33:11 -0700 Subject: [PATCH 02/17] Added continent trip is one, week duration and formatting --- index.html | 2 +- trek.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 366a8f7f..dab2c18f 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,6 @@
    - +
    diff --git a/trek.js b/trek.js index f60328b9..31bba106 100644 --- a/trek.js +++ b/trek.js @@ -7,7 +7,9 @@ var successCallback = function(response) { var target = $('#trips'); for (var i = 0; i < response.length; i++) { trip = response[i]; - target.append("
  • " + trip['name'] + "
  • "); + target.append("

    " + trip['name'] + "

    " + + ""); } } From c9d8200ad8770ab7215535ea367ad59afce05b15 Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Wed, 24 May 2017 10:14:17 -0700 Subject: [PATCH 03/17] refactored to utilize underscore in html --- index.html | 15 +++++++++++++- trek.js | 57 ++++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index dab2c18f..769563e1 100644 --- a/index.html +++ b/index.html @@ -5,10 +5,23 @@ +
    -
    +
    + + diff --git a/trek.js b/trek.js index 31bba106..a82dfe85 100644 --- a/trek.js +++ b/trek.js @@ -1,17 +1,21 @@ -var url = 'https://trektravel.herokuapp.com/trips'; +// var url = 'https://trektravel.herokuapp.com/trips'; + +var tripUrl = 'https://trektravel.herokuapp.com/trips'; var successCallback = function(response) { console.log("Success!") console.log(response); - var target = $('#trips'); - for (var i = 0; i < response.length; i++) { - trip = response[i]; - target.append("

    " + trip['name'] + "

    " + - "
      " + "
    • " + "Continent: " + trip['continent'] + "
    • " + - "
    • " + "Duration: " + trip['weeks'] + " weeks" + "
    • " + "
    "); - } -} + $(document).ready(function() { + var tripTemplate = _.template($('#trips-template').html()); + for (var i = 0; i < response.length; i++) { + var generatedHtml = tripTemplate ({ + data: response[i] + }); + $("#trips-list").append(generatedHtml); + } + }) +}; var failureCallback = function() { console.log("Didn't work"); @@ -19,9 +23,42 @@ var failureCallback = function() { } var clickHandler = function() { - $.get(url, successCallback) //passing a function around as a variable (to be invoted later.) when the request comes in, that is when it willb e called. + $.get(tripUrl, successCallback) //passing a function around as a variable (to be invoted later.) when the request comes in, that is when it willb e called. }; //as soon as the document is ready, load the page $(document).ready(function() { $('#load').click(clickHandler); }); + + + + + +////////////////////////////////////////////////////// +// var successCallback = function(response) { +// console.log("Success!") +// console.log(response); +// +// var target = $('#trips'); +// // var names = $('.trip_name') +// // var trip_details = $('.trip_details') +// for (var i = 0; i < response.length; i++) { +// trip = response[i]; +// target.append("

    " + trip['name'] + "

    " + +// "
      " + "
    • " + "Continent: " + trip['continent'] + "
    • " + +// "
    • " + "Duration: " + trip['weeks'] + " weeks" + "
    • " + "
    "); +// } +// } +// //the trip name I need to link to by id +// var failureCallback = function() { +// console.log("Didn't work"); +// $("#errors").html("

    AJAX request failed!

    "); +// } +// +// var clickHandler = function() { +// $.get(trip_url, successCallback) //passing a function around as a variable (to be invoted later.) when the request comes in, that is when it willb e called. +// }; +// //as soon as the document is ready, load the page +// $(document).ready(function() { +// $('#load').click(clickHandler); +// }); From 7e5b8a463724f92862ce8c45c3d9127af37b7958 Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Wed, 24 May 2017 10:25:39 -0700 Subject: [PATCH 04/17] linked the trip title to trip details (summary, cost, category) --- index.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 769563e1..abf8b492 100644 --- a/index.html +++ b/index.html @@ -14,12 +14,14 @@ From 68d1623c26793b582520f12af577610e5387b1f5 Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Wed, 24 May 2017 11:42:18 -0700 Subject: [PATCH 05/17] added styles.css --- close.png | Bin 0 -> 12403 bytes index.html | 1 + styles.css | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 close.png create mode 100644 styles.css diff --git a/close.png b/close.png new file mode 100644 index 0000000000000000000000000000000000000000..9678cd30b88160bf491ca738498d5bdeda5b1b0f GIT binary patch literal 12403 zcmb8Vc|4Tg8#jJthQVZCvZRJAiDG1r%up)3%98BKmavgn!&L{nTfUy39n=88 z@MvGqFn;)RaZKi+rFP=%RI1C>$Qu~*v70?QjxA}9`-Dz&VTRP5Obl`FHzjk|ktof7_ZkCJ`@{n=#9;m_!ixxMMu z@Tc1JLN2UqY;!}@ACFn5w;Lnz9}SLTtx6&?7EY!1$*k_>ljeFFuS@f$AB&ad5(Y@F ztzg%nk34Ia&N2E~(`c3J zOe{nIR2cW`cOLuy^IPmYZpt1o9?-`Jm;ol_2fB@)T)n!mdEa-VrAmig9cz-B8&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azS$9ThcG}`^%{6g zc|Sm@G}?#}BLu3bsWC?f%3OdGI~bjIGY%mTm8KVIzFoNe=Yd>zgw3~g*VlIVkA{i2LfNq1`}di*5;pPhp3_+#HD zMv#5{-e$(hZ8?C$z}vq$R^v_!;7SYf^nIYAA#wtBS{CXMD+lTuq4)y5L}*Dbbs|qc zej=tB#sePb39vsxG?x)eox!m8F{gbqO&AjRD8TPmnjf~MBamyJHaBuYNxeVX8ABq7 z&z-^N@^^~40nKbkP{<$XTfo?@g}8i`l(DeLfPivog~(8LY;P1!`AYv6(2t#3Nlywv zGlNih`2AdS_W8(29d9%r5WP*OsYN`8!1-Bz;>S)gAP70pICkn_=acieBhA#ZowSj5 z$UyDOz+aslEku8FlV^+2SZhWR>%U+aA2UV!+XABkj(6F#9JMY4@l7|L;|X3&&=z2j za_oAmzvAD#${Og^5ryq2z*x z#PN<;hjrhhtrK@3xFxCl%25}E_=0X+h{fb9)AE*er=Uo7g*)<@)IR)j@V^i01CYNP zw~(4zlg~Q=GVM>JyFB$Ele)zWnGCykde?Cm%ICh&gF70H`=O8F|}~|T*JCIDwQ+v0U=)dl0r_k z2pcPp4cA0ZQ!3@>VtPM<85rfLDAzbLSA|YqA%9R{6@#+tB~j%2O*TJWA?v_R3AMg} zFQAOOuhdycGFb_PEocV#&r)>B0jk~; + diff --git a/styles.css b/styles.css new file mode 100644 index 00000000..d07b4b38 --- /dev/null +++ b/styles.css @@ -0,0 +1,62 @@ +.modal-box { + display: none; + position: absolute; + z-index: 1000; + width: 98%; + background: white; + border-bottom: 1px solid #aaa; + border-radius: 4px; + box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); + border: 1px solid rgba(0, 0, 0, 0.1); + background-clip: padding-box; +} + +.modal-box header, +.modal-box .modal-header { + padding: 1.25em 1.5em; + border-bottom: 1px solid #ddd; +} + +.modal-box header h3, +.modal-box header h4, +.modal-box .modal-header h3, +.modal-box .modal-header h4 { margin: 0; } + +.modal-box .modal-body { padding: 2em 1.5em; } + +.modal-box footer, +.modal-box .modal-footer { + padding: 1em; + border-top: 1px solid #ddd; + background: rgba(0, 0, 0, 0.02); + text-align: right; +} + +.modal-overlay { + opacity: 0; + filter: alpha(opacity=0); + position: absolute; + top: 0; + left: 0; + z-index: 900; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.3) !important; +} + +a.close { + line-height: 1; + font-size: 1.5em; + position: absolute; + top: 5%; + right: 2%; + text-decoration: none; + color: #bbb; +} + +a.close:hover { + color: #222; + -webkit-transition: color 1s ease; + -moz-transition: color 1s ease; + transition: color 1s ease; +} From a1644b4c9c232be5bfddd7d0223b2bef8fcfea8b Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Wed, 24 May 2017 15:48:30 -0700 Subject: [PATCH 06/17] added drop down function --- index.html | 11 +++++++-- styles.css | 67 +++++++----------------------------------------------- trek.js | 40 ++++++++++++++++++-------------- 3 files changed, 40 insertions(+), 78 deletions(-) diff --git a/index.html b/index.html index 43484c6b..bf2bc8ea 100644 --- a/index.html +++ b/index.html @@ -14,9 +14,16 @@
    +
      +
    • Continent: + <%- data.continent %>
    • +
    • Duration: + <%- data.weeks %> weeks
    • +
    + + + +
    + +
    diff --git a/trek.js b/trek.js index df63d0aa..af3ae7a2 100644 --- a/trek.js +++ b/trek.js @@ -1,7 +1,7 @@ $(document).ready(function() { var tripUrl = 'https://trektravel.herokuapp.com/trips/'; - var allTrips = function(response) { + var allTrips = function(response) { // callback function console.log("Success!") console.log(response); //new template, new event handler (get request to specific trip) from there it will append the template t the slide thing @@ -15,24 +15,54 @@ $(document).ready(function() { $("#trips-list").append(generatedHtml); } - $(".flip").click(function() { - $(".info").slideToggle("slow"); + $("#trip-" + response.id).slideToggle("slow"); }); }; + var trip = function(response) { + console.log("in the trip function!!"); + console.log(response); + var tripTemplate = _.template($('#info-template').html()); + // for (var i = 0; i < response.length; i++) { + var generatedHtml = tripTemplate ({ + data: response + }); + console.log("obj id: " + "#trip-" + response.id); + $("#trip-" + response.id).replaceWith($(generatedHtml)); //need to make a specific trip append to the specific name - var failureCallback = function() { - console.log("Didn't work"); - $("#errors").html("

    AJAX request failed!

    "); - } + + }; var clickHandler = function() { $.get(tripUrl, allTrips) //passing a function around as a variable (to be invoted later.) when the request comes in, that is when it willb e called. }; + + $('#trips-list').on('click', '.trip', function(event){ + console.log("success"); + console.log(event); + console.log(this); + + var indvTrips = tripUrl + event.target.dataset.id + + $.get(indvTrips, trip) //event is a nasty object + }); + // + // var clickHandler = function() { + // tripInfoURL = tripUrl + data.id + // $.get(tripInfoURL, allTrips) + // }; //as soon as the document is ready, load the page + var failureCallback = function() { + console.log("Didn't work"); + $("#errors").html("

    AJAX request failed!

    "); + } + + + + $('#load').click(clickHandler); }); From faf2f2244d27759c8c888109cd24adf86b948f6d Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Thu, 25 May 2017 14:30:40 -0700 Subject: [PATCH 08/17] got the info(including category and cost) to show - only the slide up isn't working --- index.html | 14 ++++++++------ trek.js | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 6fbcdb86..aa219dc4 100644 --- a/index.html +++ b/index.html @@ -13,17 +13,19 @@
    +
    +

    See your next Destination

    +
    +
    +
    -
    + diff --git a/trek.js b/trek.js index ed5e73af..381e27e1 100644 --- a/trek.js +++ b/trek.js @@ -2,35 +2,33 @@ $(document).ready(function() { var tripUrl = 'https://trektravel.herokuapp.com/trips/'; var allTrips = function(response) { // callback function - console.log("Success!") - console.log(response); - //new template, new event handler (get request to specific trip) from there it will append the template t the slide thing + console.log("Success! in the allTrips function") + console.log(response); //showing what the response from the api is in the console - - var tripTemplate = _.template($('#trips-template').html()); - for (var i = 0; i < response.length; i++) { + var tripTemplate = _.template($('#trips-template').html()); // the template is connected/generates html in the first trips template + for (var i = 0; i < response.length; i++) { //going through the response var generatedHtml = tripTemplate ({ - data: response[i] + data: response[i] //so data is each trip info }); - $("#trips-list").append(generatedHtml); + $("#trips-list").append(generatedHtml); //generate the html in the trips-template script and pin it to the trips-list div } - $(".flip").click(function() { - $(".info").slideToggle("slow"); - }); + }; - var trip = function(response) { - console.log("in the trip function!!"); - console.log(response); + var trip = function(response) { //another callback function + console.log("Success in the trip function! (indvidual trip info)"); + console.log(response); // shows the api response var tripTemplate = _.template($('#trips-template').html()); - // for (var i = 0; i < response.length; i++) { + //here you don't need to iterate because now the response is just one object var generatedHtml = tripTemplate ({ data: response }); console.log("obj id: " + "#trip-" + response.id); $("#trip-" + response.id).replaceWith(generatedHtml); //need to make a specific trip append to the specific name - + $(".flip").click(function() { + $(".info").slideToggle("slow"); + }); }; @@ -44,19 +42,15 @@ $(document).ready(function() { console.log(event); console.log(this); - var indvTrips = tripUrl + event.target.dataset.id + var indvTrips = tripUrl + event.target.dataset.id //this is similar to going into a nested hash or array + //go into event, then to target, then to dataset, then get the id. - $.get(indvTrips, trip) //event is a nasty object + $.get(indvTrips, trip) //event is just a nasty large object }); - // - // var clickHandler = function() { - // tripInfoURL = tripUrl + data.id - // $.get(tripInfoURL, allTrips) - // }; - //as soon as the document is ready, load the page + var failureCallback = function() { - console.log("Didn't work"); + console.log("Didn't work, in the failure callback"); $("#errors").html("

    AJAX request failed!

    "); } From 1dc85670a83870d42a0ab7f2505f9dcbf9adafad Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Fri, 26 May 2017 10:12:06 -0700 Subject: [PATCH 10/17] trying to get .hide function to work --- index.html | 3 ++- trek.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index a3aada29..2edb9377 100644 --- a/index.html +++ b/index.html @@ -23,13 +23,14 @@

    > <%- data.name %>

    +
    >

    Details: <%- data.about %>

    Category: <%- data.category %>

    Cost: $<%- data.cost %>

    - +
    • Continent: diff --git a/trek.js b/trek.js index 381e27e1..196566d4 100644 --- a/trek.js +++ b/trek.js @@ -10,7 +10,9 @@ $(document).ready(function() { var generatedHtml = tripTemplate ({ data: response[i] //so data is each trip info }); + $("#trips-list").append(generatedHtml); //generate the html in the trips-template script and pin it to the trips-list div + $("#test").hide(); } From fde62368b92c06b20c25ec89b09fabbf3c3fb8df Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Fri, 26 May 2017 11:09:21 -0700 Subject: [PATCH 11/17] got a form to show up --- index.html | 21 +++++++++++++++++---- trek.js | 12 ++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index a3aada29..1989cf04 100644 --- a/index.html +++ b/index.html @@ -25,18 +25,31 @@

      >
      >

      Details: <%- data.about %>

      -

      Category: <%- data.category %>

      -

      Cost: $<%- data.cost %>

      - +
        +
      • Category: <%- data.category %>
      • +
      • Cost: $<%- data.cost %>
      • +
      -
      • Continent: <%- data.continent %>
      • Duration: <%- data.weeks %> weeks
      + +
      +
      + + +
      +
      + + +
      +
      + +

    diff --git a/trek.js b/trek.js index 381e27e1..de038c74 100644 --- a/trek.js +++ b/trek.js @@ -33,6 +33,18 @@ $(document).ready(function() { }; + $("form").submit(function(event) { + event.preventDefault(); + + var url = $(this).attr("action"); + var formData = $(this).serialize(); + console.log(formData) + + $.post(url, formData, function(response){ + console.log(response); + }); + }); + var clickHandler = function() { $.get(tripUrl, allTrips) //passing a function around as a variable (to be invoted later.) when the request comes in, that is when it willb e called. }; From f23be8b09e6bb641148f7f0dfae3573963b84a25 Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Fri, 26 May 2017 11:11:47 -0700 Subject: [PATCH 12/17] switching to new branch --- index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 1989cf04..3fc4add2 100644 --- a/index.html +++ b/index.html @@ -50,7 +50,10 @@

    >
    -
    + +
    + +

    From 857a2e8fa504163c7880ddb8572f5810d1f4fdf0 Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Fri, 26 May 2017 14:02:49 -0700 Subject: [PATCH 13/17] added a new template to fix the empty description bug. Still need to deal with not calling the api more thna once even if the title is clicked on again. --- index.html | 74 +++++++++++++++++++++++++++++++++++------------------- trek.js | 4 +-- 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/index.html b/index.html index 926da269..a5d8f5ee 100644 --- a/index.html +++ b/index.html @@ -23,15 +23,14 @@

    > <%- data.name %>

    -
    -
    > + +
      @@ -41,31 +40,54 @@

      > <%- data.weeks %> weeks

    - -
    - - -
    -
    - - -
    -
    - - -
    -
    - -
    +
    - +
    + + +
    +
    + + +
    +
    + +
    + + + + + + + + diff --git a/trek.js b/trek.js index 5f0e73d2..eae0b142 100644 --- a/trek.js +++ b/trek.js @@ -21,13 +21,13 @@ $(document).ready(function() { var trip = function(response) { //another callback function console.log("Success in the trip function! (indvidual trip info)"); console.log(response); // shows the api response - var tripTemplate = _.template($('#trips-template').html()); + var tripTemplate = _.template($('#trip-dets').html()); //here you don't need to iterate because now the response is just one object var generatedHtml = tripTemplate ({ data: response }); console.log("obj id: " + "#trip-" + response.id); - $("#trip-" + response.id).replaceWith(generatedHtml); //need to make a specific trip append to the specific name + $("#trip-" + response.id).append(generatedHtml); //need to make a specific trip append to the specific name $(".flip").click(function() { $(".info").slideToggle("slow"); }); From 84c04eab2591ab27995484bf18839e98067b93e8 Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Fri, 26 May 2017 15:24:04 -0700 Subject: [PATCH 14/17] switching to slide branch --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index a5d8f5ee..6659bb38 100644 --- a/index.html +++ b/index.html @@ -59,7 +59,7 @@

    >

    - + + "/reserve" method="post">
    From 8a56dce3aefebe9eac90c7737af79c0583ba2765 Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Fri, 26 May 2017 15:26:53 -0700 Subject: [PATCH 15/17] fixed something wrong with the form section tag --- index.html | 2 +- trek.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 6659bb38..30c9dca7 100644 --- a/index.html +++ b/index.html @@ -59,7 +59,7 @@

    > - + "/reserve" method="post"> + + "/reserve" method="post">
    diff --git a/trek.js b/trek.js index eae0b142..374e7206 100644 --- a/trek.js +++ b/trek.js @@ -27,6 +27,7 @@ $(document).ready(function() { data: response }); console.log("obj id: " + "#trip-" + response.id); + $("#trip-" + response.id).append(generatedHtml); //need to make a specific trip append to the specific name $(".flip").click(function() { $(".info").slideToggle("slow"); From b7edc7f88d74e881b2c6b87e5e87665206b90e7c Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Tue, 30 May 2017 06:16:14 -0700 Subject: [PATCH 16/17] changed the html so it would recognize and save the correct trip id --- index.html | 25 +++++++++---------------- trek.js | 4 ++-- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/index.html b/index.html index 30c9dca7..80ae38e2 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,7 @@ +
    @@ -49,17 +50,19 @@

    > - - - - diff --git a/trek.js b/trek.js index 374e7206..6c362480 100644 --- a/trek.js +++ b/trek.js @@ -27,7 +27,7 @@ $(document).ready(function() { data: response }); console.log("obj id: " + "#trip-" + response.id); - + $("#trip-" + response.id).append(generatedHtml); //need to make a specific trip append to the specific name $(".flip").click(function() { $(".info").slideToggle("slow"); @@ -49,7 +49,7 @@ $(document).ready(function() { }); var clickHandler = function() { - $.get(tripUrl, allTrips) //passing a function around as a variable (to be invoted later.) when the request comes in, that is when it willb e called. + $.get(tripUrl, allTrips) //passing a function around as a variable (to be invoked later.) when the request comes in, that is when it willb e called. }; $('#trips-list').on('click', '.trip', function(event){ From e9a0ef254b1ff0a3bac7fb5025985c06abc48123 Mon Sep 17 00:00:00 2001 From: Allison Northrop Date: Tue, 30 May 2017 07:41:43 -0700 Subject: [PATCH 17/17] added styling --- index.html | 21 +++++++-------------- styles.css | 19 ++++++++++++++++++- trek.js | 19 ++++++++----------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index 80ae38e2..17dd5791 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,11 @@ + + + + + @@ -11,8 +16,8 @@
    -

    See your next Destination

    - +

    Travel Treks

    +
    @@ -24,24 +29,12 @@

    > <%- data.name %>

    - - - -
    • Continent: <%- data.continent %>
    • Duration: <%- data.weeks %> weeks
    - - diff --git a/styles.css b/styles.css index d490908d..a53a6db5 100644 --- a/styles.css +++ b/styles.css @@ -2,10 +2,27 @@ padding: 5px; text-align: center; background-color: #e5eecc; - border: solid 1px #c3c3c3; + /*border: solid 1px #c3c3c3;*/ } .info { padding: 50px; display: none; } + +h1 { + font-family: 'Permanent Marker', cursive; + font-size: 80px; + color: #595D7F; +} + +h2 { + font-family: 'Permanent Marker', cursive; + color: #137F7E; +} + +p, ul, form { + font-family: 'Open Sans', sans-serif; + color: #595D7F; + +} diff --git a/trek.js b/trek.js index 6c362480..df661c61 100644 --- a/trek.js +++ b/trek.js @@ -23,15 +23,15 @@ $(document).ready(function() { console.log(response); // shows the api response var tripTemplate = _.template($('#trip-dets').html()); //here you don't need to iterate because now the response is just one object - var generatedHtml = tripTemplate ({ - data: response - }); - console.log("obj id: " + "#trip-" + response.id); + var generatedHtml = tripTemplate ({ + data: response + }); + console.log("obj id: " + "#trip-" + response.id); - $("#trip-" + response.id).append(generatedHtml); //need to make a specific trip append to the specific name - $(".flip").click(function() { - $(".info").slideToggle("slow"); - }); + $("#trip-" + response.id).append(generatedHtml); //need to make a specific trip append to the specific name + $(".flip").click(function() { + $(".info").slideToggle("slow"); + }); }; @@ -69,9 +69,6 @@ $(document).ready(function() { $("#errors").html("

    AJAX request failed!

    "); } - - - $('#load').click(clickHandler); });