1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-23 22:25:14 -04:00

UI will reload on navigation if the backend has been update

This commit is contained in:
Mark McDowall
2013-11-13 19:38:30 -08:00
parent 541cd0ce19
commit c286f1b18a
7 changed files with 98 additions and 57 deletions
+22 -2
View File
@@ -1,15 +1,20 @@
'use strict';
define(
[
'vent',
'AppLayout',
'marionette',
'Shared/NotFoundView'
], function (AppLayout, Marionette, NotFoundView) {
], function (vent, AppLayout, Marionette, NotFoundView) {
return Marionette.AppRouter.extend({
initialize: function () {
this.listenTo(vent, vent.Events.ServerUpdated, this._onServerUpdated);
},
showNotFound: function () {
this.setTitle('Not Found');
AppLayout.mainRegion.show(new NotFoundView(this));
this.showMainRegion(new NotFoundView(this));
},
setTitle: function (title) {
@@ -19,6 +24,21 @@ define(
else {
document.title = title + ' - NzbDrone';
}
},
_onServerUpdated: function () {
this.pendingUpdate = true;
},
showMainRegion: function (view) {
if (this.pendingUpdate) {
window.location.reload();
}
else {
//AppLayout
AppLayout.mainRegion.show(view);
}
}
});
});