From 60d99e4d35568b3fb76eb26f0284236b4cd602c3 Mon Sep 17 00:00:00 2001 From: lowercasename Date: Thu, 2 Jan 2020 20:24:55 +1100 Subject: Export as ICS functionality --- views/event.handlebars | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'views/event.handlebars') diff --git a/views/event.handlebars b/views/event.handlebars index 4d0cf28..70c4018 100755 --- a/views/event.handlebars +++ b/views/event.handlebars @@ -45,6 +45,9 @@ Add to Google Calendar + {{#if eventHasHost}}
  • @@ -375,6 +378,29 @@ }) $(document).ready(function() { + // From https://davidwalsh.name/javascript-download + function downloadFile(data, fileName, type="text/plain") { + // Create an invisible A element + const a = document.createElement("a"); + a.style.display = "none"; + document.body.appendChild(a); + + // Set the HREF to a Blob representation of the data to be downloaded + a.href = window.URL.createObjectURL( + new Blob([data], { type }) + ); + + // Use download attribute to set set desired file name + a.setAttribute("download", fileName); + + // Trigger the download by simulating click + a.click(); + + // Cleanup + window.URL.revokeObjectURL(a.href); + document.body.removeChild(a); + } + $.uploadPreview({ input_field: "#image-upload", preview_box: "#image-preview", @@ -394,6 +420,12 @@ {{/if}} new ClipboardJS('#copyEventLink'); autosize($('textarea')); + $("#exportICS").click(function(){ + let eventID = $(this).attr('data-event-id'); + $.get('/exportevent/' + eventID, function(response) { + downloadFile(response, eventID + '.ics'); + }) + }) $("#copyEventLink").click(function(){ $(this).html(' Copied!'); setTimeout(function(){ $("#copyEventLink").html(' Copy');}, 5000); -- cgit v1.2.3 From 80ab983d93ac079ac7fc5a7af631d08605a84377 Mon Sep 17 00:00:00 2001 From: lowercasename Date: Thu, 2 Jan 2020 21:53:23 +1100 Subject: Some style tweaks --- public/css/style.css | 16 ++++-- views/event.handlebars | 143 ++++++++++++++++++++++++++----------------------- 2 files changed, 87 insertions(+), 72 deletions(-) (limited to 'views/event.handlebars') diff --git a/public/css/style.css b/public/css/style.css index 4085875..e55f07a 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -115,6 +115,11 @@ body, html { text-transform:capitalize; } +#eventActions { + padding-left: 0; + margin-top: 1rem; +} + /* .location, .eventLink { display: flex; @@ -162,10 +167,6 @@ body, html { margin-left: 5px; } -.eventInformationAction:not(#copyEventLink) { - margin-top: 0.25rem; -} - .commentContainer { background: #fafafa; border-radius: 5px; @@ -308,6 +309,13 @@ body, html { } } +@media (min-width: 1120px) { + #eventActions { + margin-top: 0; + padding-left: 1rem; + } +} + @media (min-width: 577px) { #sidebar { border-right: 2px solid #e0e0e0; diff --git a/views/event.handlebars b/views/event.handlebars index 70c4018..7a57783 100755 --- a/views/event.handlebars +++ b/views/event.handlebars @@ -8,85 +8,92 @@

    {{eventData.name}}

    {{#if editingEnabled}} -
    +
    - - + +
    {{/if}}
    -
    -
    - + + Show on Google Maps + + + Show on OpenStreetMap + + +
    + {{#if eventHasConcluded}}
    -
    +
    • @@ -154,21 +154,26 @@
    - -
    \ No newline at end of file +
    + + \ No newline at end of file -- cgit v1.2.3