mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
making modals event driven,
This commit is contained in:
parent
121f3b973d
commit
62cea8de5e
18 changed files with 100 additions and 53 deletions
|
@ -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',
|
||||
|
@ -78,7 +77,7 @@ define(
|
|||
_getFanArt: function () {
|
||||
var fanArt = _.where(this.model.get('images'), {coverType: 'fanart'});
|
||||
|
||||
if(fanArt && fanArt[0]){
|
||||
if (fanArt && fanArt[0]) {
|
||||
return fanArt[0].url;
|
||||
}
|
||||
|
||||
|
@ -117,18 +116,17 @@ 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 () {
|
||||
Actioneer.ExecuteCommand({
|
||||
command : 'refreshSeries',
|
||||
properties : {
|
||||
seriesId : this.model.get('id')
|
||||
command : 'refreshSeries',
|
||||
properties: {
|
||||
seriesId: this.model.get('id')
|
||||
},
|
||||
element : this.ui.refresh,
|
||||
leaveIcon : true
|
||||
element : this.ui.refresh,
|
||||
leaveIcon : true
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -143,7 +141,7 @@ define(
|
|||
Actioneer.ExecuteCommand({
|
||||
command : 'renameSeries',
|
||||
properties : {
|
||||
seriesId : this.model.get('id')
|
||||
seriesId: this.model.get('id')
|
||||
},
|
||||
element : this.ui.rename,
|
||||
failMessage: 'Series search failed'
|
||||
|
@ -154,7 +152,7 @@ define(
|
|||
Actioneer.ExecuteCommand({
|
||||
command : 'seriesSearch',
|
||||
properties : {
|
||||
seriesId : this.model.get('id')
|
||||
seriesId: this.model.get('id')
|
||||
},
|
||||
element : this.ui.search,
|
||||
failMessage : 'Series search failed',
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue