Sonarr/UI/Controller.js

116 lines
3.6 KiB
JavaScript
Raw Normal View History

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