1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-28 10:51:48 +00:00
Radarr/UI/Shared/Modal/Controller.js
2013-08-25 22:34:00 -07:00

48 lines
1.7 KiB
JavaScript

'use strict';
define(
[
'app',
'marionette',
'Series/Edit/EditSeriesView',
'Series/Delete/DeleteSeriesView',
'Episode/Layout',
'History/Details/HistoryDetailsView'
], function (App, Marionette, EditSeriesView, DeleteSeriesView, EpisodeLayout, HistoryDetailsView) {
var router = Marionette.AppRouter.extend({
initialize: function () {
App.vent.on(App.Commands.CloseModalCommand, this._closeModal, this);
App.vent.on(App.Commands.EditSeriesCommand, this._editSeries, this);
App.vent.on(App.Commands.DeleteSeriesCommand, this._deleteSeries, this);
App.vent.on(App.Commands.ShowEpisodeDetails, this._showEpisode, this);
App.vent.on(App.Commands.ShowHistoryDetails, this._showHistory, this);
},
_closeModal: function () {
App.modalRegion.closeModal();
},
_editSeries: function (options) {
var view = new EditSeriesView({ model: options.series });
App.modalRegion.show(view);
},
_deleteSeries: function (options) {
var view = new DeleteSeriesView({ model: options.series });
App.modalRegion.show(view);
},
_showEpisode: function (options) {
var view = new EpisodeLayout({ model: options.episode, hideSeriesLink: options.hideSeriesLink });
App.modalRegion.show(view);
},
_showHistory: function (options) {
var view = new HistoryDetailsView({ model: options.history });
App.modalRegion.show(view);
}
});
return new router();
});