2013-06-29 01:06:16 +02:00
|
|
|
|
'use strict';
|
2013-06-21 07:19:41 +02:00
|
|
|
|
define(
|
|
|
|
|
[
|
|
|
|
|
'app',
|
2013-06-25 01:41:59 +02:00
|
|
|
|
'marionette',
|
|
|
|
|
'History/HistoryLayout',
|
2013-06-21 07:19:41 +02:00
|
|
|
|
'Settings/SettingsLayout',
|
|
|
|
|
'AddSeries/AddSeriesLayout',
|
|
|
|
|
'Series/Index/SeriesIndexLayout',
|
|
|
|
|
'Series/Details/SeriesDetailsLayout',
|
2013-08-02 02:12:31 +02:00
|
|
|
|
'Series/SeriesCollection',
|
2013-06-25 01:41:59 +02:00
|
|
|
|
'Missing/MissingLayout',
|
|
|
|
|
'Series/SeriesModel',
|
|
|
|
|
'Calendar/CalendarLayout',
|
2013-06-21 07:19:41 +02:00
|
|
|
|
'Logs/Layout',
|
2013-07-29 01:13:14 +02:00
|
|
|
|
'Logs/Files/Layout',
|
2013-06-21 07:19:41 +02:00
|
|
|
|
'Release/Layout',
|
2013-07-28 22:20:26 +02:00
|
|
|
|
'System/Layout',
|
2013-08-05 11:09:41 +02:00
|
|
|
|
'SeasonPass/Layout',
|
2013-07-20 01:08:41 +02:00
|
|
|
|
'Shared/NotFoundView',
|
|
|
|
|
'Shared/Modal/Region'
|
2013-08-02 02:24:00 +02:00
|
|
|
|
], function (App, Marionette, HistoryLayout, SettingsLayout, AddSeriesLayout, SeriesIndexLayout, SeriesDetailsLayout, SeriesCollection, MissingLayout, SeriesModel, CalendarLayout,
|
2013-08-05 11:09:41 +02:00
|
|
|
|
LogsLayout, LogFileLayout, ReleaseLayout, SystemLayout, SeasonPassLayout, NotFoundView) {
|
2013-06-25 01:41:59 +02:00
|
|
|
|
return Marionette.Controller.extend({
|
2013-03-30 00:28:58 +01:00
|
|
|
|
|
2013-08-02 02:24:00 +02:00
|
|
|
|
series: function () {
|
2013-04-19 01:14:08 +02:00
|
|
|
|
this._setTitle('NzbDrone');
|
2013-06-25 01:41:59 +02:00
|
|
|
|
App.mainRegion.show(new SeriesIndexLayout());
|
2013-03-30 00:28:58 +01:00
|
|
|
|
},
|
2013-07-28 22:20:26 +02:00
|
|
|
|
|
2013-03-30 00:28:58 +01:00
|
|
|
|
seriesDetails: function (query) {
|
2013-08-02 02:24:00 +02:00
|
|
|
|
var series = SeriesCollection.where({titleSlug: query});
|
2013-03-30 00:28:58 +01:00
|
|
|
|
|
2013-08-02 02:24:00 +02:00
|
|
|
|
if (series.length != 0) {
|
2013-08-02 02:12:31 +02:00
|
|
|
|
var targetSeries = series[0];
|
|
|
|
|
this._setTitle(targetSeries.get('title'));
|
|
|
|
|
App.mainRegion.show(new SeriesDetailsLayout({ model: targetSeries }));
|
|
|
|
|
}
|
2013-08-02 02:24:00 +02:00
|
|
|
|
else {
|
|
|
|
|
this.notFound();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2013-04-19 01:14:08 +02:00
|
|
|
|
addSeries: function (action) {
|
|
|
|
|
this._setTitle('Add Series');
|
2013-06-21 07:19:41 +02:00
|
|
|
|
App.mainRegion.show(new AddSeriesLayout({action: action}));
|
2013-04-19 01:14:08 +02:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
calendar: function () {
|
|
|
|
|
this._setTitle('Calendar');
|
2013-06-25 01:41:59 +02:00
|
|
|
|
App.mainRegion.show(new CalendarLayout());
|
2013-04-19 01:14:08 +02:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
settings: function (action) {
|
|
|
|
|
this._setTitle('Settings');
|
2013-06-19 03:02:23 +02:00
|
|
|
|
App.mainRegion.show(new SettingsLayout({action: action}));
|
2013-03-30 00:28:58 +01:00
|
|
|
|
},
|
|
|
|
|
|
2013-04-19 01:14:08 +02:00
|
|
|
|
missing: function () {
|
|
|
|
|
this._setTitle('Missing');
|
2013-03-30 00:28:58 +01:00
|
|
|
|
|
2013-06-24 04:31:02 +02:00
|
|
|
|
App.mainRegion.show(new MissingLayout());
|
2013-03-30 00:28:58 +01:00
|
|
|
|
},
|
|
|
|
|
|
2013-05-03 08:53:32 +02:00
|
|
|
|
history: function () {
|
|
|
|
|
this._setTitle('History');
|
|
|
|
|
|
2013-06-24 04:31:02 +02:00
|
|
|
|
App.mainRegion.show(new HistoryLayout());
|
2013-05-03 08:53:32 +02:00
|
|
|
|
},
|
|
|
|
|
|
2013-06-05 07:08:10 +02:00
|
|
|
|
rss: function () {
|
|
|
|
|
this._setTitle('RSS');
|
2013-06-25 01:41:59 +02:00
|
|
|
|
App.mainRegion.show(new ReleaseLayout());
|
2013-06-05 07:08:10 +02:00
|
|
|
|
},
|
|
|
|
|
|
2013-07-29 01:13:14 +02:00
|
|
|
|
logs: function (action) {
|
|
|
|
|
if (action) {
|
|
|
|
|
this._setTitle('log files');
|
|
|
|
|
App.mainRegion.show(new LogFileLayout());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
this._setTitle('logs');
|
|
|
|
|
App.mainRegion.show(new LogsLayout());
|
|
|
|
|
}
|
2013-06-05 02:49:53 +02:00
|
|
|
|
},
|
|
|
|
|
|
2013-07-28 22:20:26 +02:00
|
|
|
|
system: function () {
|
|
|
|
|
this._setTitle('system');
|
|
|
|
|
App.mainRegion.show(new SystemLayout());
|
|
|
|
|
},
|
|
|
|
|
|
2013-08-05 11:09:41 +02:00
|
|
|
|
seasonPass: function () {
|
|
|
|
|
this._setTitle('Season Pass');
|
|
|
|
|
App.mainRegion.show(new SeasonPassLayout());
|
|
|
|
|
},
|
|
|
|
|
|
2013-03-30 00:28:58 +01:00
|
|
|
|
notFound: function () {
|
2013-04-19 01:14:08 +02:00
|
|
|
|
this._setTitle('Not Found');
|
2013-06-25 01:41:59 +02:00
|
|
|
|
App.mainRegion.show(new NotFoundView(this));
|
2013-03-30 00:28:58 +01:00
|
|
|
|
},
|
|
|
|
|
|
2013-04-19 01:14:08 +02:00
|
|
|
|
_setTitle: function (title) {
|
2013-04-24 03:55:29 +02:00
|
|
|
|
//$('#title-region').html(title);
|
2013-03-30 00:28:58 +01:00
|
|
|
|
|
|
|
|
|
if (title.toLocaleLowerCase() === 'nzbdrone') {
|
|
|
|
|
window.document.title = 'NzbDrone';
|
2013-03-02 20:13:23 +01:00
|
|
|
|
}
|
2013-03-30 00:28:58 +01:00
|
|
|
|
else {
|
|
|
|
|
window.document.title = title + ' - NzbDrone';
|
2013-03-04 01:09:43 +01:00
|
|
|
|
}
|
2013-03-30 00:28:58 +01:00
|
|
|
|
}
|
|
|
|
|
});
|
2013-02-16 01:49:25 +01:00
|
|
|
|
});
|
2013-02-16 00:38:53 +01:00
|
|
|
|
|