2013-07-24 04:15:58 +03:00
|
|
|
'use strict';
|
|
|
|
define(
|
|
|
|
[
|
|
|
|
'app',
|
|
|
|
'marionette',
|
|
|
|
'Series/Edit/EditSeriesView',
|
|
|
|
'Series/Delete/DeleteSeriesView',
|
|
|
|
'Episode/Layout'
|
|
|
|
|
|
|
|
], function (App, Marionette, EditSeriesView, DeleteSeriesView, EpisodeLayout) {
|
|
|
|
|
|
|
|
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);
|
|
|
|
},
|
|
|
|
|
|
|
|
_closeModal: function () {
|
2013-07-24 07:16:52 +03:00
|
|
|
App.modalRegion.closeModal();
|
2013-07-24 04:15:58 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
_editSeries: function (options) {
|
2013-07-24 07:16:52 +03:00
|
|
|
var view = new EditSeriesView({ model: options.series });
|
2013-07-24 04:15:58 +03:00
|
|
|
App.modalRegion.show(view);
|
|
|
|
},
|
|
|
|
|
|
|
|
_deleteSeries: function (options) {
|
2013-07-24 07:16:52 +03:00
|
|
|
var view = new DeleteSeriesView({ model: options.series });
|
2013-07-24 04:15:58 +03:00
|
|
|
App.modalRegion.show(view);
|
|
|
|
},
|
|
|
|
|
|
|
|
_showEpisode: function (options) {
|
2013-07-24 07:16:52 +03:00
|
|
|
var view = new EpisodeLayout({ model: options.episode });
|
2013-07-24 04:15:58 +03:00
|
|
|
App.modalRegion.show(view);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return new router();
|
|
|
|
});
|