mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 09:03:49 -07:00
making modals event driven,
This commit is contained in:
parent
2083a86c2a
commit
00dcce469d
18 changed files with 100 additions and 53 deletions
42
UI/Shared/Modal/Controller.js
Normal file
42
UI/Shared/Modal/Controller.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
'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 () {
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
},
|
||||
|
||||
_editSeries: function (options) {
|
||||
var view = new EditSeriesView({ model: options.model });
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
|
||||
_deleteSeries: function (options) {
|
||||
var view = new DeleteSeriesView({ model: options.model });
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
|
||||
_showEpisode: function (options) {
|
||||
var view = new EpisodeLayout({ model: options.model });
|
||||
App.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
|
||||
return new router();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue