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

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

Loading…
Cancel
Save