Skip to content

Commit

Permalink
Merge pull request #90 from fac-17/feature/calendar-link
Browse files Browse the repository at this point in the history
Adds google calendar link
  • Loading branch information
sarahyjja authored Sep 13, 2019
2 parents c01c123 + a54bf7a commit 5578db2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
32 changes: 19 additions & 13 deletions public/js/finalPage.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
// const friend = "Bryan";
friend = "Bryan";

// Google Calendar
// Calendar
const linkGoogleCalendar = document.querySelector(".link-calendar-google");
const linkOutlookCalendar = document.querySelector(".link-calendar-outlook");

const linkCalendar = document.querySelector(".link-calendar");

let calendarTitle = `Meeting ${friend}`;
// url encoded name of the event:
let calendarTitle = `Meeting+${friend}`;
//dates in IOS format
let startTime = "20190913T193000Z";
let endTime = "20190913T223000Z";
let venue = "North%20Pole";

linkCalendar.href = `http://www.google.com/calendar/render?
action=TEMPLATE
&text=${calendarTitle}
&dates=${startTime}/${endTime}
&location=${venue}`;
//url encoded location of the event:
let venue = "North+Pole";
let GoogleCalendarHref = `https://calendar.google.com/calendar/r/eventedit?text=${calendarTitle}&dates=${startTime}/${endTime}&location=${venue}`;

// Citymapper Route

const linkCitymapper = document.querySelector(".link-citymapper");

let startLat = "51.41828";
Expand All @@ -25,5 +22,14 @@ let endLat = "51.537060";
let endLon = "0.079179";
let endName = "The%20Proud%20Archivist";
let arrivalTime = "2016-08-06T21%3A00%2B01%3A00";
let cityMapperHref = `https://citymapper.com/directions?startcoord=${startLat}%2C${startLon}&endcoord=${endLat}%2C${endLon}&endname=${endName}&arrival_time=${arrivalTime}`;

linkCitymapper.href = `https://citymapper.com/directions?startcoord=${startLat}%2C${startLon}&endcoord=${endLat}%2C${endLon}&endname=${endName}&arrival_time=${arrivalTime}`;

const setURL = (domElement, url) => {
domElement.href = url;
};

console.log(linkCitymapper);
setURL(linkCitymapper, cityMapperHref);
setURL(linkGoogleCalendar, GoogleCalendarHref);
5 changes: 3 additions & 2 deletions src/views/final.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
<span class="final-venu"></span>
</p>

<a href="#" target="_blank" rel="nofollow" class="link-calendar">Add to my calendar</a>
<a href='#' target="_blank" class="link-citymapper"><img
<a target="_blank" rel="nofollow" class="link-calendar-google">Add to my Google calendar</a>

<a href="" target="_blank" class="link-citymapper"><img
src="https://static.citymapper.com/img/embed/GetMeThere_Citymapper.png"
alt="Get directions with Citymapper" /></a>
</main>
2 changes: 0 additions & 2 deletions src/views/layouts/main.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
{{!-- jsPath is provided as context when page is rendered --}}
<script src="{{jsPath}}"></script>
<script src="/js/homePage.js"></script>
<script src='require.js'></script>

</body>


Expand Down

0 comments on commit 5578db2

Please sign in to comment.