1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/UI/Controller.js

116 lines
3.6 KiB
JavaScript
Raw Normal View History

'use strict';
2013-06-21 08:19:41 +03:00
define(
[
'app',
'marionette',
'History/HistoryLayout',
2013-06-21 08:19:41 +03:00
'Settings/SettingsLayout',
'AddSeries/AddSeriesLayout',
'Series/Index/SeriesIndexLayout',
'Series/Details/SeriesDetailsLayout',
'Series/SeriesCollection',
'Missing/MissingLayout',
'Series/SeriesModel',
'Calendar/CalendarLayout',
2013-06-21 08:19:41 +03:00
'Logs/Layout',
2013-07-29 02:13:14 +03:00
'Logs/Files/Layout',
2013-06-21 08:19:41 +03:00
'Release/Layout',
2013-07-28 23:20:26 +03:00
'System/Layout',
'SeasonPass/Layout',
2013-07-20 02:08:41 +03: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 23:20:26 +03: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 08:19:41 +03: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 04:02:23 +03:00
App.mainRegion.show(new SettingsLayout({action: action}));
},
missing: function () {
this._setTitle('Missing');
2013-06-24 05:31:02 +03:00
App.mainRegion.show(new MissingLayout());
},
2013-05-03 09:53:32 +03:00
history: function () {
this._setTitle('History');
2013-06-24 05:31:02 +03:00
App.mainRegion.show(new HistoryLayout());
2013-05-03 09:53:32 +03:00
},
rss: function () {
this._setTitle('RSS');
App.mainRegion.show(new ReleaseLayout());
},
2013-07-29 02:13:14 +03: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 03:49:53 +03:00
},
2013-07-28 23:20:26 +03: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 22:13:23 +03:00
}
else {
window.document.title = title + ' - NzbDrone';
2013-03-04 03:09:43 +03:00
}
}
});
2013-02-16 03:49:25 +03:00
});
2013-02-16 02:38:53 +03:00