New: iCal calendar feed.

This commit is contained in:
Taloth Saldono
2014-03-14 21:30:49 +01:00
committed by Taloth
parent cf1e0a4946
commit 794c09c17a
7 changed files with 61 additions and 44 deletions

View File

@@ -2,15 +2,24 @@
define(
[
'marionette',
], function (Marionette) {
'System/StatusModel',
'Mixins/CopyToClipboard'
], function (Marionette, StatusModel) {
return Marionette.Layout.extend({
template: 'Calendar/CalendarFeedViewTemplate',
onRender: function() {
// hackish way to determine the correct url, as using urlBase seems to only work for reverse proxies or so
var ics = '//' + window.location.host + '/feed/calendar/NzbDrone.ics';
this.$('#ical-url').val(window.location.protocol + ics);
this.$('#ical-subscribe-button').attr('href', 'webcal:' + ics);
}
ui: {
icalUrl : '.x-ical-url',
icalCopy : '.x-ical-copy'
},
templateHelpers: {
icalHttpUrl : window.location.protocol + '//' + window.location.host + StatusModel.get('urlBase') + '/feed/calendar/NzbDrone.ics',
icalWebCalUrl : 'webcal://' + window.location.host + StatusModel.get('urlBase') + '/feed/calendar/NzbDrone.ics'
},
onShow: function () {
this.ui.icalCopy.copyToClipboard(this.ui.icalUrl);
}
});
});