diff --git a/docs-web/src/main/webapp/src/app/docs/app.js b/docs-web/src/main/webapp/src/app/docs/app.js index 9e1891fa..4a1f981e 100644 --- a/docs-web/src/main/webapp/src/app/docs/app.js +++ b/docs-web/src/main/webapp/src/app/docs/app.js @@ -106,6 +106,15 @@ angular.module('docs', } } }) + .state('settings.vocabulary', { + url: '/vocabulary', + views: { + 'settings': { + templateUrl: 'partial/docs/settings.vocabulary.html', + controller: 'SettingsVocabulary' + } + } + }) .state('document', { url: '/document', abstract: true, diff --git a/docs-web/src/main/webapp/src/app/docs/controller/SettingsVocabulary.js b/docs-web/src/main/webapp/src/app/docs/controller/SettingsVocabulary.js new file mode 100644 index 00000000..e23cf437 --- /dev/null +++ b/docs-web/src/main/webapp/src/app/docs/controller/SettingsVocabulary.js @@ -0,0 +1,42 @@ +'use strict'; + +/** + * Settings vocabulary page controller. + */ +angular.module('docs').controller('SettingsVocabulary', function($scope, Restangular) { + $scope.entries = []; + + // Watch for vocabulary selection change + $scope.$watch('vocabulary', function(name) { + if (_.isUndefined(name) || name == '') { + $scope.entries = []; + return; + } + + // Load entries + Restangular.one('vocabulary', name).get().then(function(result) { + $scope.entries = result.entries; + }); + }); + + // Delete an entry + $scope.deleteEntry = function(entry) { + Restangular.one('vocabulary', entry.id).remove().then(function() { + $scope.entries.splice($scope.entries.indexOf(entry), 1); + }); + }; + + // Update an entry + $scope.updateEntry = function(entry) { + Restangular.one('vocabulary', entry.id).post('', entry); + }; + + // Add an entry + $scope.addEntry = function(entry) { + entry.name = $scope.vocabulary; + Restangular.one('vocabulary').put(entry).then(function() { + $scope.entries.push(entry); + $scope.entry = {}; + }); + }; +}); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/index.html b/docs-web/src/main/webapp/src/index.html index e17c2c29..a49b177c 100644 --- a/docs-web/src/main/webapp/src/index.html +++ b/docs-web/src/main/webapp/src/index.html @@ -60,6 +60,7 @@ + diff --git a/docs-web/src/main/webapp/src/partial/docs/settings.html b/docs-web/src/main/webapp/src/partial/docs/settings.html index d3246e12..4bc1a5d0 100644 --- a/docs-web/src/main/webapp/src/partial/docs/settings.html +++ b/docs-web/src/main/webapp/src/partial/docs/settings.html @@ -12,6 +12,7 @@
Value | +Order | ++ |
---|---|---|
+ + | ++ + | ++ + | +
+ | ||
+ + | ++ + | ++ + | +