Fixed issue with image manager js not being updated
This commit is contained in:
parent
69eff86ff5
commit
1f03d8fb2a
1 changed files with 12 additions and 4 deletions
|
@ -9,7 +9,9 @@ window.ImageManager = new Vue({
|
||||||
hasMore: false,
|
hasMore: false,
|
||||||
page: 0,
|
page: 0,
|
||||||
cClickTime: 0,
|
cClickTime: 0,
|
||||||
selectedImage: false
|
selectedImage: false,
|
||||||
|
dependantPages: false,
|
||||||
|
deleteForm: {}
|
||||||
},
|
},
|
||||||
|
|
||||||
created: function () {
|
created: function () {
|
||||||
|
@ -63,6 +65,7 @@ window.ImageManager = new Vue({
|
||||||
this.hide();
|
this.hide();
|
||||||
} else {
|
} else {
|
||||||
this.selectedImage = (this.selectedImage === image) ? false : image;
|
this.selectedImage = (this.selectedImage === image) ? false : image;
|
||||||
|
this.dependantPages = false;
|
||||||
}
|
}
|
||||||
this.cClickTime = cTime;
|
this.cClickTime = cTime;
|
||||||
},
|
},
|
||||||
|
@ -106,15 +109,20 @@ window.ImageManager = new Vue({
|
||||||
deleteImage: function (e) {
|
deleteImage: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var _this = this;
|
var _this = this;
|
||||||
var form = $(_this.$$.imageDeleteForm);
|
_this.deleteForm.force = _this.dependantPages !== false;
|
||||||
$.ajax('/images/' + _this.selectedImage.id, {
|
$.ajax('/images/' + _this.selectedImage.id, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
data: form.serialize()
|
data: _this.deleteForm
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
_this.images.splice(_this.images.indexOf(_this.selectedImage), 1);
|
_this.images.splice(_this.images.indexOf(_this.selectedImage), 1);
|
||||||
_this.selectedImage = false;
|
_this.selectedImage = false;
|
||||||
$(_this.$$.imageTitle).showSuccess('Image Deleted');
|
$(_this.$$.imageTitle).showSuccess('Image Deleted');
|
||||||
})
|
}).fail(function(jqXHR, textStatus) {
|
||||||
|
// Pages failure
|
||||||
|
if(jqXHR.status === 400) {
|
||||||
|
_this.dependantPages = jqXHR.responseJSON;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue