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