Lidarr/UI/Shared/Modal/Controller.js

49 lines
1.7 KiB
JavaScript
Raw Normal View History

2013-07-24 01:15:58 +00:00
'use strict';
define(
[
'app',
'marionette',
'Series/Edit/EditSeriesView',
'Series/Delete/DeleteSeriesView',
2013-08-26 05:31:58 +00:00
'Episode/Layout',
'History/Details/HistoryDetailsView'
], function (App, Marionette, EditSeriesView, DeleteSeriesView, EpisodeLayout, HistoryDetailsView) {
2013-07-24 01:15:58 +00:00
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);
2013-08-26 05:31:58 +00:00
App.vent.on(App.Commands.ShowHistoryDetails, this._showHistory, this);
2013-07-24 01:15:58 +00:00
},
_closeModal: function () {
App.modalRegion.closeModal();
2013-07-24 01:15:58 +00:00
},
_editSeries: function (options) {
var view = new EditSeriesView({ model: options.series });
2013-07-24 01:15:58 +00:00
App.modalRegion.show(view);
},
_deleteSeries: function (options) {
var view = new DeleteSeriesView({ model: options.series });
2013-07-24 01:15:58 +00:00
App.modalRegion.show(view);
},
_showEpisode: function (options) {
2013-08-21 21:47:39 +00:00
var view = new EpisodeLayout({ model: options.episode, hideSeriesLink: options.hideSeriesLink });
2013-07-24 01:15:58 +00:00
App.modalRegion.show(view);
2013-08-26 05:31:58 +00:00
},
_showHistory: function (options) {
var view = new HistoryDetailsView({ model: options.history });
App.modalRegion.show(view);
2013-07-24 01:15:58 +00:00
}
});
return new router();
});