1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-22 14:11:39 +00:00

Closes #237: prevent tag circular reference

This commit is contained in:
Benjamin Gamard
2018-10-19 17:04:49 +02:00
parent 8fff672d2f
commit 7baf5e44fd
4 changed files with 39 additions and 10 deletions

View File

@@ -21,7 +21,15 @@ angular.module('docs').controller('TagEdit', function($scope, $stateParams, Rest
*/
$scope.edit = function() {
// Update the server
Restangular.one('tag', $scope.tag.id).post('', $scope.tag);
Restangular.one('tag', $scope.tag.id).post('', $scope.tag).then(function () {
}, function (e) {
if (e.data.type === 'CircularReference') {
var title = $translate.instant('tag.edit.circular_reference_title');
var msg = $translate.instant('tag.edit.circular_reference_message');
var btns = [{result: 'ok', label: $translate.instant('ok'), cssClass: 'btn-primary'}];
$dialog.messageBox(title, msg, btns);
}
});
};
/**

View File

@@ -219,7 +219,9 @@
"name": "Name",
"color": "Color",
"parent": "Parent",
"info": "Permissions on this tag will also be applied to documents tagged <span class=\"label label-info\" ng-style=\"{ 'background': color }\">{{ name }}</span>"
"info": "Permissions on this tag will also be applied to documents tagged <span class=\"label label-info\" ng-style=\"{ 'background': color }\">{{ name }}</span>",
"circular_reference_title": "Circular reference",
"circular_reference_message": "The hierarchy of parent tags makes a loop, please choose another parent."
}
},
"group": {