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:
@@ -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);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user