diff --git a/docs-web/src/main/webapp/src/app/docs/controller/document/Document.js b/docs-web/src/main/webapp/src/app/docs/controller/document/Document.js index e5e45180..4276a661 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/document/Document.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/document/Document.js @@ -338,4 +338,27 @@ angular.module('docs').controller('Document', function ($scope, $rootScope, $tim return _.pluck(children, 'name').join(', ') + (tag.children.length > 2 ? '...' : ''); }; + + /** + * Add a tag in the current navigation context. + */ + $scope.addTagHere = function () { + $uibModal.open({ + templateUrl: 'partial/docs/document.add.tag.html', + controller: 'DocumentModalAddTag' + }).result.then(function (tag) { + if (tag === null) { + return; + } + + // Create the tag + tag.parent = $scope.navigatedTag ? $scope.navigatedTag.id : undefined; + Restangular.one('tag').put(tag).then(function (data) { + // Add the new tag to the list + tag.id = data.id; + tag.children = []; + $scope.tags.push(tag); + }) + }); + }; }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentModalAddTag.js b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentModalAddTag.js new file mode 100644 index 00000000..e78d0c8f --- /dev/null +++ b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentModalAddTag.js @@ -0,0 +1,11 @@ +'use strict'; + +/** + * Document modal add tag controller. + */ +angular.module('docs').controller('DocumentModalAddTag', function ($scope, $uibModalInstance) { + $scope.tag = { name: '', color: '#3a87ad' }; + $scope.close = function(tag) { + $uibModalInstance.close(tag); + } +}); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/app/docs/controller/tag/Tag.js b/docs-web/src/main/webapp/src/app/docs/controller/tag/Tag.js index b652b868..86338a63 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/tag/Tag.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/tag/Tag.js @@ -3,7 +3,7 @@ /** * Tag controller. */ -angular.module('docs').controller('Tag', function($scope, Restangular, $state) { +angular.module('docs').controller('Tag', function($scope, Restangular) { $scope.tag = { name: '', color: '#3a87ad' }; // Retrieve tags diff --git a/docs-web/src/main/webapp/src/index.html b/docs-web/src/main/webapp/src/index.html index b63cd652..f6b70f99 100644 --- a/docs-web/src/main/webapp/src/index.html +++ b/docs-web/src/main/webapp/src/index.html @@ -66,6 +66,7 @@ + diff --git a/docs-web/src/main/webapp/src/partial/docs/document.add.tag.html b/docs-web/src/main/webapp/src/partial/docs/document.add.tag.html new file mode 100644 index 00000000..993c9724 --- /dev/null +++ b/docs-web/src/main/webapp/src/partial/docs/document.add.tag.html @@ -0,0 +1,19 @@ + +
+ + +
diff --git a/docs-web/src/main/webapp/src/partial/docs/document.html b/docs-web/src/main/webapp/src/partial/docs/document.html index 7580c0d9..aa13682d 100644 --- a/docs-web/src/main/webapp/src/partial/docs/document.html +++ b/docs-web/src/main/webapp/src/partial/docs/document.html @@ -174,12 +174,22 @@ ng-if="navigatedTag"> + + + diff --git a/docs-web/src/main/webapp/src/partial/docs/tag.html b/docs-web/src/main/webapp/src/partial/docs/tag.html index addc048f..a2f3e2dc 100644 --- a/docs-web/src/main/webapp/src/partial/docs/tag.html +++ b/docs-web/src/main/webapp/src/partial/docs/tag.html @@ -20,7 +20,7 @@ ng-maxlength="36" required ng-model="tag.name" ui-validate="{ space: '!$value || $value.indexOf(\' \') == -1' }"> {{ 'add' | translate }}

- {{ 'validation.no_space' | translate }} + {{ 'validation.no_space' | translate }}