mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
making modals event driven,
This commit is contained in:
parent
2083a86c2a
commit
00dcce469d
@ -49,7 +49,8 @@ define(
|
||||
},
|
||||
|
||||
_folderSelected: function (options) {
|
||||
App.modalRegion.closeModal();
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
|
||||
this.workspace.show(new ExistingSeriesCollectionView({model: options.model}));
|
||||
},
|
||||
|
||||
|
@ -98,7 +98,7 @@ define(
|
||||
},
|
||||
|
||||
_setRootFolder: function (options) {
|
||||
App.modalRegion.closeModal();
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
this.ui.rootFolder.val(options.model.id);
|
||||
},
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
@ -6,7 +6,6 @@ define(
|
||||
'marionette',
|
||||
'moment',
|
||||
'Calendar/Collection',
|
||||
'Episode/Layout',
|
||||
'fullcalendar'
|
||||
], function (App, Marionette, Moment, CalendarCollection, EpisodeLayout) {
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
'use strict';
|
||||
define({
|
||||
ApiRoot : '/api'
|
||||
});
|
@ -49,7 +49,7 @@ define(
|
||||
message: 'Search started for: ' + message
|
||||
});
|
||||
|
||||
App.modalRegion.closeModal();
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
},
|
||||
|
||||
_searchManual: function (e) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict';
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'History/Model',
|
||||
|
@ -25,7 +25,7 @@ define(
|
||||
wait: true
|
||||
}).done(function () {
|
||||
App.vent.trigger(App.Events.SeriesDeleted, { series: self.model });
|
||||
App.modalRegion.closeModal();
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -6,11 +6,10 @@ define(
|
||||
'Series/EpisodeCollection',
|
||||
'Series/SeasonCollection',
|
||||
'Series/Details/SeasonCollectionView',
|
||||
'Series/Edit/EditSeriesView',
|
||||
'Shared/LoadingView',
|
||||
'Shared/Actioneer',
|
||||
'backstrech'
|
||||
], function (App, Marionette, EpisodeCollection, SeasonCollection, SeasonCollectionView, EditSeriesView, LoadingView, Actioneer) {
|
||||
], function (App, Marionette, EpisodeCollection, SeasonCollection, SeasonCollectionView, LoadingView, Actioneer) {
|
||||
return Marionette.Layout.extend({
|
||||
|
||||
itemViewContainer: '.x-series-seasons',
|
||||
@ -117,8 +116,7 @@ define(
|
||||
},
|
||||
|
||||
_editSeries: function () {
|
||||
var view = new EditSeriesView({ model: this.model });
|
||||
App.modalRegion.show(view);
|
||||
App.vent.trigger(App.Commands.EditSeriesCommand, {model: this.model});
|
||||
},
|
||||
|
||||
_refreshSeries: function () {
|
||||
|
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'App',
|
||||
'app',
|
||||
'marionette',
|
||||
'Series/Delete/DeleteSeriesView',
|
||||
'Quality/QualityProfileCollection',
|
||||
@ -18,8 +18,8 @@ define(
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-save' : 'saveSeries',
|
||||
'click .x-remove': 'removeSeries'
|
||||
'click .x-save' : '_saveSeries',
|
||||
'click .x-remove': '_removeSeries'
|
||||
},
|
||||
|
||||
|
||||
@ -28,22 +28,23 @@ define(
|
||||
},
|
||||
|
||||
|
||||
saveSeries: function () {
|
||||
_saveSeries: function () {
|
||||
|
||||
var self = this;
|
||||
var qualityProfileId = this.ui.qualityProfile.val();
|
||||
this.model.set({ qualityProfileId: qualityProfileId});
|
||||
|
||||
this.model.save();
|
||||
this.trigger('saved');
|
||||
App.modalRegion.closeModal();
|
||||
|
||||
this.model.save().done(function () {
|
||||
self.trigger('saved');
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
});
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.ui.path.autoComplete('/directories');
|
||||
},
|
||||
|
||||
removeSeries: function () {
|
||||
_removeSeries: function () {
|
||||
var view = new DeleteSeriesView({ model: this.model });
|
||||
App.modalRegion.show(view);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ define(['app', 'marionette'], function (App, Marionette) {
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success: function () {
|
||||
App.modalRegion.closeModal();
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
@ -26,7 +26,7 @@ define(
|
||||
if (promise) {
|
||||
promise.done(function () {
|
||||
self.indexerCollection.add(self.model, { merge: true });
|
||||
App.modalRegion.closeModal();
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -11,7 +11,7 @@ define(['app', 'marionette'], function (App, Marionette) {
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success: function () {
|
||||
App.modalRegion.closeModal();
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ define([
|
||||
if (promise) {
|
||||
promise.done(function () {
|
||||
self.notificationCollection.add(self.model, { merge: true });
|
||||
App.modalRegion.closeModal();
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ define(
|
||||
this.model.destroy({
|
||||
wait: true
|
||||
}).done(function () {
|
||||
App.modalRegion.closeModal();
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -63,7 +63,7 @@ define(['app', 'marionette', 'Mixins/AsModelBoundView'], function (App, Marionet
|
||||
if (promise) {
|
||||
promise.done(function () {
|
||||
self.profileCollection.add(self.model, { merge: true });
|
||||
App.modalRegion.closeModal();
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
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();
|
||||
});
|
@ -39,11 +39,17 @@ define(
|
||||
|
||||
});
|
||||
|
||||
require(
|
||||
[
|
||||
'Shared/Modal/Controller'
|
||||
], function () {
|
||||
|
||||
app.addInitializer(function () {
|
||||
app.addRegions({
|
||||
modalRegion: region
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return region;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user