mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Added iCal feed for the calendar, reachable through
/feed/calendar/NzbDrone.ics or through the calendar page.
This commit is contained in:
parent
7445adb455
commit
cf1e0a4946
10 changed files with 165 additions and 4 deletions
16
src/UI/Calendar/CalendarFeedView.js
Normal file
16
src/UI/Calendar/CalendarFeedView.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
], function (Marionette) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
26
src/UI/Calendar/CalendarFeedViewTemplate.html
Normal file
26
src/UI/Calendar/CalendarFeedViewTemplate.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>NzbDrone Calendar feed</h3>
|
||||
</div>
|
||||
<div class="modal-body edit-series-modal">
|
||||
<div class="row">
|
||||
<div>
|
||||
<div class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="ical-url">iCal feed</label>
|
||||
|
||||
<div class="controls">
|
||||
<input type="text" id="ical-url" class="x-ical-url" value="/feed/calendar/NzbDrone.ics" name="ical-url">
|
||||
<span class="help-inline">
|
||||
<i class="icon-nd-form-info" title="copy this url into your clients subscription form or use the subscribe now link if you have a webcal protocol handler installed"/>
|
||||
</span>
|
||||
or <a href="webcal:///feed/calendar/NzbDrone.ics" id="ical-subscribe-button">subscribe now!</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">close</button>
|
||||
</div>
|
|
@ -1,10 +1,12 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Calendar/UpcomingCollectionView',
|
||||
'Calendar/CalendarView'
|
||||
], function (Marionette, UpcomingCollectionView, CalendarView) {
|
||||
'Calendar/CalendarView',
|
||||
'Calendar/CalendarFeedView'
|
||||
], function (AppLayout, Marionette, UpcomingCollectionView, CalendarView, CalendarFeedView) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Calendar/CalendarLayoutTemplate',
|
||||
|
||||
|
@ -12,6 +14,10 @@ define(
|
|||
upcoming: '#x-upcoming',
|
||||
calendar: '#x-calendar'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-ical': '_showiCal'
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this._showUpcoming();
|
||||
|
@ -24,6 +30,11 @@ define(
|
|||
|
||||
_showCalendar: function () {
|
||||
this.calendar.show(new CalendarView());
|
||||
},
|
||||
|
||||
_showiCal: function () {
|
||||
var view = new CalendarFeedView();
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
<div class="row">
|
||||
<div class="span3">
|
||||
<h4>Upcoming</h4>
|
||||
<div class="pull-left">
|
||||
<h4>Upcoming</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<h4>
|
||||
<i class="icon-calendar-empty ical x-ical"></i>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="x-upcoming"/>
|
||||
</div>
|
||||
<div class=span9>
|
||||
|
|
|
@ -158,3 +158,13 @@
|
|||
margin-right: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.ical
|
||||
{
|
||||
color: @btnInverseBackground;
|
||||
}
|
||||
|
||||
#ical-url
|
||||
{
|
||||
width: 370px;
|
||||
}
|
|
@ -23,6 +23,8 @@
|
|||
<link rel="apple-touch-icon" sizes="114x114" href="/Content/Images/touch/114.png?v=2"/>
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="/Content/Images/touch/144.png?v=2"/>
|
||||
<link rel="icon" type="image/ico" href="/Content/Images/favicon.ico?v=2"/>
|
||||
|
||||
<link rel="alternate" type="text/calendar" title="iCalendar feed for NzbDrone" href="/feed/calendar/NzbDrone.ics" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="nav-region"></div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue