mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-27 16:22:37 +00:00
Cancelling adding an indexer will stop listening to save event
Fixed: Cancelling adding indexer will not break saving
This commit is contained in:
parent
1cae7293e7
commit
cc66077943
3 changed files with 16 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close x-cancel"aria-hidden="true">×</button>
|
||||||
{{#if id}}
|
{{#if id}}
|
||||||
<h3>Edit</h3>
|
<h3>Edit</h3>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
<span class="x-activity"></span>
|
<span class="x-activity"></span>
|
||||||
|
|
||||||
<button class="btn" data-dismiss="modal">cancel</button>
|
<button class="btn x-cancel">cancel</button>
|
||||||
|
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button class="btn btn-primary x-save">save</button>
|
<button class="btn btn-primary x-save">save</button>
|
||||||
|
|
|
@ -18,7 +18,8 @@ define(
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .x-save' : '_save',
|
'click .x-save' : '_save',
|
||||||
'click .x-save-and-add': '_saveAndAdd'
|
'click .x-save-and-add': '_saveAndAdd',
|
||||||
|
'click .x-cancel' : '_cancel'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
|
@ -68,6 +69,13 @@ define(
|
||||||
self.ui.activity.empty();
|
self.ui.activity.empty();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_cancel: function () {
|
||||||
|
if (this.model.isNew()) {
|
||||||
|
this.model.destroy();
|
||||||
|
vent.trigger(vent.Commands.CloseModalCommand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ define(
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
this.listenTo(vent, vent.Commands.SaveSettings, this.saveSettings);
|
this.listenTo(vent, vent.Commands.SaveSettings, this.saveSettings);
|
||||||
|
this.listenTo(this, 'destroy', this._stopListening);
|
||||||
},
|
},
|
||||||
|
|
||||||
saveSettings: function () {
|
saveSettings: function () {
|
||||||
|
@ -28,8 +29,11 @@ define(
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
_stopListening: function () {
|
||||||
|
this.stopListening(vent, vent.Commands.SaveSettings);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return AsChangeTrackingModel.call(model);
|
return AsChangeTrackingModel.call(model);
|
||||||
|
|
Loading…
Reference in a new issue