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