fix(images): display an error message when unable to remove an image (#114)

pull/115/head
Anthony Lapenna 8 years ago committed by GitHub
parent 9293b28ef4
commit ea6e11000d

@ -71,15 +71,17 @@ function ($scope, $state, Image, Messages) {
if (i.Checked) {
counter = counter + 1;
Image.remove({id: i.Id}, function (d) {
angular.forEach(d, function (resource) {
Messages.send("Image deleted", resource.Deleted);
});
var index = $scope.images.indexOf(i);
$scope.images.splice(index, 1);
if (d[0].message) {
$('#loadingViewSpinner').hide();
Messages.error("Unable to remove image", d[0].message);
} else {
Messages.send("Image deleted", i.Id);
var index = $scope.images.indexOf(i);
$scope.images.splice(index, 1);
}
complete();
}, function (e) {
Messages.error("Failure", e.data);
$('#loadImagesSpinner').hide();
Messages.error("Unable to remove image", e.data);
complete();
});
}

@ -152,11 +152,11 @@ module.exports = function (grunt) {
}
},
angular: {
src: ['bower_components/angular/angular.min.js',
src: ['bower_components/angular/angular.js',
'bower_components/angular-sanitize/angular-sanitize.min.js',
'bower_components/angular-cookies/angular-cookies.min.js',
'bower_components/angular-ui-router/release/angular-ui-router.min.js',
'bower_components/angular-resource/angular-resource.min.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
'bower_components/angular-ui-select/dist/select.min.js'],
dest: '<%= distdir %>/js/angular.js'

Loading…
Cancel
Save