1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-31 03:11:07 +02:00
Sonarr/src/UI/Shared/NzbDroneController.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

2013-10-09 04:43:41 +03:00
'use strict';
define(
[
'vent',
2013-10-09 04:43:41 +03:00
'AppLayout',
'marionette',
'Shared/NotFoundView'
], function (vent, AppLayout, Marionette, NotFoundView) {
2013-10-09 04:43:41 +03:00
return Marionette.AppRouter.extend({
initialize: function () {
this.listenTo(vent, vent.Events.ServerUpdated, this._onServerUpdated);
},
2013-10-09 04:43:41 +03:00
showNotFound: function () {
this.setTitle('Not Found');
this.showMainRegion(new NotFoundView(this));
2013-10-09 04:43:41 +03:00
},
setTitle: function (title) {
if (title.toLocaleLowerCase() === 'nzbdrone') {
2013-11-11 07:09:11 +03:00
document.title = 'NzbDrone';
2013-10-09 04:43:41 +03:00
}
else {
2013-11-11 07:09:11 +03:00
document.title = title + ' - NzbDrone';
2013-10-09 04:43:41 +03:00
}
},
_onServerUpdated: function () {
this.pendingUpdate = true;
},
showMainRegion: function (view) {
if (this.pendingUpdate) {
window.location.reload();
}
else {
//AppLayout
AppLayout.mainRegion.show(view);
}
2013-10-09 04:43:41 +03:00
}
});
});