diff --git a/.meteor/packages b/.meteor/packages index 7eef4d5..e49d91b 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -42,3 +42,4 @@ coderstv:chat meteorhacks:kadira cottz:publish-relations manuelschoebel:ms-seo +pfafman:filesaver diff --git a/.meteor/versions b/.meteor/versions index eb8dfbe..c22a3ef 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -76,6 +76,7 @@ oauth2@1.1.2 observe-sequence@1.0.4 ordered-dict@1.0.2 patrickleet:tags@1.1.3 +pfafman:filesaver@0.2.0_1 raix:handlebar-helpers@0.2.4 random@1.0.2 reactive-dict@1.0.5 diff --git a/client/lib/ics-calendar.js b/client/lib/ics-calendar.js new file mode 100644 index 0000000..2c16d20 --- /dev/null +++ b/client/lib/ics-calendar.js @@ -0,0 +1,23 @@ +ics = {}; + +ics.createFile = function (data) { + 'use strict'; + var calendar = 'BEGIN:VCALENDAR\r\n' + +'CALSCALE:GREGORIAN\r\n' + +'PRODID:-//CodersTV//Calendar CodersTV//EN\r\n' + +'VERSION:2.0\r\n' + +'BEGIN:VEVENT\r\n' + +'LOCATION:CodersTV - http://coderstv.com\r\n' + +'DTSTART;TZID=America/Sao_Paulo:'+ moment().add(1, 'day').format('YYYYMMDDTHHmmss') + '\r\n' + +'DTEND;TZID=America/Sao_Paulo:'+ moment().add(1, 'day').format('YYYYMMDDTHHmmss') + '\r\n' + +'DESCRIPTION: '+ data.description.substring(0, 50) + '\r\n' + +'SUMMARY:CodersTV - '+ data.title.substring(0, 25) + ' \r\n' + +'BEGIN:VALARM\r\n' + +'TRIGGER:-PT1H\r\n' + +'ACTION:DISPLAY\r\n' + +'END:VALARM\r\n' + +'ORGANIZER;CN="CodersTV":mailto:help@coderstv.com\r\n' + +'END:VEVENT\r\n' + +'END:VCALENDAR\r\n'; + return calendar; +}; diff --git a/client/views/agenda/agenda.html b/client/views/agenda/agenda.html index ab3779c..87711be 100644 --- a/client/views/agenda/agenda.html +++ b/client/views/agenda/agenda.html @@ -14,7 +14,7 @@

{{#if $eq owner $.Meteor.userId}}
- {{#if isActive}} + {{#if isActive}} {{else}} @@ -65,13 +65,19 @@

{{profile.name}}

Share this event:
{{#with title}} - {{> shareit_twitter title=this}} + {{> shareit_twitter title=this}} {{> shareit_fb title=this}} {{> shareit_google title=this}} {{/with}}
+
+
Add this event to your agenda:
+ + Download ics + +
- +
diff --git a/client/views/agenda/agenda.js b/client/views/agenda/agenda.js index 585faad..f3070bb 100644 --- a/client/views/agenda/agenda.js +++ b/client/views/agenda/agenda.js @@ -8,7 +8,7 @@ Template.agenda.events({ }, 'click .follow-coder': function (event) { var coderId = Router.current().data().owner; - + if (Meteor.user()) { $(event.target).popover('hide'); } else { @@ -51,6 +51,12 @@ Template.agenda.events({ var _id = Router.current().data()._id; Schedule.uncancel(_id); + }, + 'click .download-ics': function(event) { + event.preventDefault(); + var blob = new Blob([ics.createFile(this)], + {type: 'text/calendar;charset=UTF-8'}); + return saveAs(blob, 'coderstv-calendar.ics'); } }); @@ -104,7 +110,7 @@ Disqus.SSO = function () { Session.set('disqusSSO', res); window.disqus_config = function () { - this.page.identifier = Path(); + this.page.identifier = Path(); this.page.url = Meteor.absoluteUrl() + Path().substr(1); if (! _.isEmpty(res)) { this.page.remote_auth_s3 = res.auth; @@ -119,8 +125,8 @@ Disqus.reset = function () { try { DISQUS.reset({ reload: true, - config: function () { - this.page.identifier = Path(); + config: function () { + this.page.identifier = Path(); this.page.url = Meteor.absoluteUrl() + Path().substr(1); if (! _.isEmpty(disqusSSO)) { this.page.remote_auth_s3 = disqusSSO.auth; @@ -129,6 +135,6 @@ Disqus.reset = function () { } }); } catch (err) { - + } };