mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-24 22:35:39 -04:00
Fixed: Cancelling editing a modal will reset to previous saved state
This commit is contained in:
@@ -6,19 +6,19 @@ define(
|
||||
'Profile/ProfileCollection',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView',
|
||||
'Mixins/AsEditModalView',
|
||||
'Mixins/AutoComplete'
|
||||
], function (vent, Marionette, Profiles, AsModelBoundView, AsValidatedView) {
|
||||
], function (vent, Marionette, Profiles, AsModelBoundView, AsValidatedView, AsEditModalView) {
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Series/Edit/EditSeriesViewTemplate',
|
||||
|
||||
ui: {
|
||||
profile: '.x-profile',
|
||||
path : '.x-path'
|
||||
profile : '.x-profile',
|
||||
path : '.x-path'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-save' : '_saveSeries',
|
||||
'click .x-remove': '_removeSeries'
|
||||
},
|
||||
|
||||
@@ -27,16 +27,14 @@ define(
|
||||
this.model.set('profiles', Profiles);
|
||||
},
|
||||
|
||||
_saveSeries: function () {
|
||||
|
||||
var self = this;
|
||||
_onBeforeSave: function () {
|
||||
var profileId = this.ui.profile.val();
|
||||
this.model.set({ profileId: profileId});
|
||||
},
|
||||
|
||||
this.model.save().done(function () {
|
||||
self.trigger('saved');
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
});
|
||||
_onAfterSave: function () {
|
||||
this.trigger('saved');
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
@@ -48,7 +46,9 @@ define(
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
AsEditModalView.call(view);
|
||||
|
||||
AsModelBoundView.apply(view);
|
||||
return AsValidatedView.apply(view);
|
||||
return view;
|
||||
});
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
<div class="modal-body edit-series-modal">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 hidden-xs">
|
||||
<img class="series-poster" src="{{poster}}"
|
||||
{{defaultImg}}>
|
||||
<img class="series-poster" src="{{poster}}" {{defaultImg}}>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="form-horizontal">
|
||||
@@ -89,6 +88,8 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-danger pull-left x-remove">delete</button>
|
||||
|
||||
<span class="indicator x-indicator"><i class="icon-spinner icon-spin"></i></span>
|
||||
<button class="btn" data-dismiss="modal">cancel</button>
|
||||
<button class="btn btn-primary x-save">save</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user