diff --git a/docs-web/src/main/webapp/src/app/docs/controller/DocumentView.js b/docs-web/src/main/webapp/src/app/docs/controller/DocumentView.js index bf71478d..c286f38a 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/DocumentView.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/DocumentView.js @@ -11,6 +11,40 @@ angular.module('docs').controller('DocumentView', function ($scope, $state, $sta $scope.error = response; }); + // Load comments from server + Restangular.one('comment', $stateParams.id).get().then(function(data) { + $scope.comments = data.comments; + }, function(response) { + $scope.commentsError = response; + }); + + /** + * Add a comment. + */ + $scope.comment = ''; + $scope.addComment = function() { + if ($scope.comment.length == 0) { + return; + } + + Restangular.one('comment').put({ + id: $stateParams.id, + content: $scope.comment + }).then(function(data) { + $scope.comment = ''; + $scope.comments.push(data); + }); + }; + + /** + * Delete a comment. + */ + $scope.deleteComment = function(comment) { + Restangular.one('comment', comment.id).remove().then(function() { + $scope.comments.splice($scope.comments.indexOf(comment), 1); + }); + }; + /** * Delete a document. */ @@ -24,7 +58,7 @@ angular.module('docs').controller('DocumentView', function ($scope, $state, $sta $dialog.messageBox(title, msg, btns, function (result) { if (result == 'ok') { - Restangular.one('document', document.id).remove().then(function () { + Restangular.one('document', document.id).remove().then(function() { $scope.loadDocuments(); $state.go('document.default'); }); diff --git a/docs-web/src/main/webapp/src/partial/docs/directive.auditlog.html b/docs-web/src/main/webapp/src/partial/docs/directive.auditlog.html index 6b4ee994..1986122f 100644 --- a/docs-web/src/main/webapp/src/partial/docs/directive.auditlog.html +++ b/docs-web/src/main/webapp/src/partial/docs/directive.auditlog.html @@ -18,7 +18,7 @@ Open - See + See {{ log.message }} diff --git a/docs-web/src/main/webapp/src/partial/docs/document.view.content.html b/docs-web/src/main/webapp/src/partial/docs/document.view.content.html index 1c36141b..5042d3ce 100644 --- a/docs-web/src/main/webapp/src/partial/docs/document.view.content.html +++ b/docs-web/src/main/webapp/src/partial/docs/document.view.content.html @@ -1,4 +1,4 @@ - + diff --git a/docs-web/src/main/webapp/src/partial/docs/document.view.html b/docs-web/src/main/webapp/src/partial/docs/document.view.html index c5eda6cd..5ad747e5 100644 --- a/docs-web/src/main/webapp/src/partial/docs/document.view.html +++ b/docs-web/src/main/webapp/src/partial/docs/document.view.html @@ -60,7 +60,35 @@ - Comments + + + Comments + + + + + Loading... + No comments on this document yet + Error loading comments + + + + {{ comment.creator }} + + {{ comment.content }} + {{ comment.create_date | date: 'yyyy-MM-dd' }} + Delete + + + + + + Email address + + + \ No newline at end of file
+ + Comments +
Loading...
No comments on this document yet
Error loading comments
+ {{ comment.content }} + {{ comment.create_date | date: 'yyyy-MM-dd' }} + Delete +