From d4fd81bc2c0a55bdad488d487612b194c1dac64e Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Wed, 9 Aug 2017 18:32:06 +0200 Subject: [PATCH] author and email visible in comment list --- .../main/js/gui/admin/CommentsAdminPanel.js | 6 ++--- frontend-js/src/main/js/map/data/Comment.js | 23 +++++++++++++++---- ...d,pinned,author,email&token=MOCK_TOKEN_ID& | 1 + 3 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 frontend-js/testFiles/apiCalls/projects/sample/comments/models/all/columns=id,elementId,modelId,type,removed,pinned,author,email&token=MOCK_TOKEN_ID& diff --git a/frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js b/frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js index 431f3759d6..9e36a93242 100644 --- a/frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js +++ b/frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js @@ -127,7 +127,7 @@ CommentsAdminPanel.prototype.onProjectChange = function() { var self = this; var projectSelect = $("[name='projectSelect']", self.getElement())[0]; return ServerConnector.getComments({ - projectId : projectSelect.value + projectId : projectSelect.value, }).then( function(comments) { var dataTable = $($("[name='commentsTable']", self.getElement())[0]).DataTable(); @@ -141,8 +141,8 @@ CommentsAdminPanel.prototype.onProjectChange = function() { } for (var i = 0; i < comments.length; i++) { var comment = comments[i]; - data.push([ comment.getId(), comment.getTitle(), "", "", comment.getContent(), toYesNo(comment.isRemoved()), - toYesNo(comment.isPinned()) ]); + data.push([ comment.getId(), comment.getTitle(), comment.getAuthor(), comment.getEmail(), + comment.getContent(), toYesNo(comment.isRemoved()), toYesNo(comment.isPinned()) ]); logger.debug("Add comment: ", comments[i]); } dataTable.clear().rows.add(data).draw(); diff --git a/frontend-js/src/main/js/map/data/Comment.js b/frontend-js/src/main/js/map/data/Comment.js index 5ad0a787d5..735e508c1d 100644 --- a/frontend-js/src/main/js/map/data/Comment.js +++ b/frontend-js/src/main/js/map/data/Comment.js @@ -12,12 +12,14 @@ function Comment(javaObject) { this.setId(javaObject.id); this.setRemoved(javaObject.removed); this.setPinned(javaObject.pinned); - + if (javaObject.title !== undefined) { this.setCoordinates(javaObject.coord); this.setTitle(javaObject.title); this.setContent(javaObject.content); } + this.setAuthor(javaObject.author); + this.setEmail(javaObject.email); } Comment.prototype.setIdentifiedElement = function(ie) { @@ -42,9 +44,6 @@ Comment.prototype.setRemoved = function(removed) { Comment.prototype.setId = function(id) { this._id = id; }; -Comment.prototype.setTitle = function(title) { - this._title = title; -}; Comment.prototype.setContent = function(content) { this._content = content; }; @@ -61,6 +60,9 @@ Comment.prototype.isRemoved = function() { Comment.prototype.getId = function() { return this._id; }; +Comment.prototype.setTitle = function(title) { + this._title = title; +}; Comment.prototype.getTitle = function() { return this._title; }; @@ -68,4 +70,17 @@ Comment.prototype.getContent = function() { return this._content; }; +Comment.prototype.setAuthor = function(author) { + this._author = author; +}; +Comment.prototype.getAuthor = function() { + return this._author; +}; +Comment.prototype.setEmail = function(email) { + this._email = email; +}; +Comment.prototype.getEmail = function() { + return this._email; +}; + module.exports = Comment; diff --git a/frontend-js/testFiles/apiCalls/projects/sample/comments/models/all/columns=id,elementId,modelId,type,removed,pinned,author,email&token=MOCK_TOKEN_ID& b/frontend-js/testFiles/apiCalls/projects/sample/comments/models/all/columns=id,elementId,modelId,type,removed,pinned,author,email&token=MOCK_TOKEN_ID& new file mode 100644 index 0000000000..ede6101ebe --- /dev/null +++ b/frontend-js/testFiles/apiCalls/projects/sample/comments/models/all/columns=id,elementId,modelId,type,removed,pinned,author,email&token=MOCK_TOKEN_ID& @@ -0,0 +1 @@ +[{"elementId":"1.00,200.00","pinned":true,"removed":false,"modelId":15781,"author":"test","id":4506,"type":"POINT","email":"email"},{"elementId":"100.00,200.00","pinned":true,"removed":false,"modelId":15781,"author":"test","id":4507,"type":"POINT","email":"email"},{"elementId":"1.00,200.00","pinned":true,"removed":false,"modelId":15781,"author":"test","id":4508,"type":"POINT","email":"email"},{"elementId":"1.00,200.00","pinned":true,"removed":false,"modelId":15781,"author":"test","id":4509,"type":"POINT","email":"email"},{"elementId":"1.00,200.00","pinned":true,"removed":false,"modelId":15781,"author":"test","id":4510,"type":"POINT","email":"email"},{"elementId":"2.00,12.00","pinned":false,"removed":false,"modelId":15781,"author":"","id":4511,"type":"POINT","email":""},{"elementId":"322.43,28.04","pinned":false,"removed":false,"modelId":15781,"author":"qwe","id":4512,"type":"POINT","email":"asd"},{"elementId":"1108.74,525.06","pinned":false,"removed":false,"modelId":15781,"author":"qwe","id":4513,"type":"POINT","email":"asdxzf"},{"elementId":329158,"pinned":false,"removed":false,"modelId":15781,"author":"complex12","id":4514,"type":"ALIAS","email":""},{"elementId":329166,"pinned":false,"removed":false,"modelId":15781,"author":"cnc","id":4515,"type":"ALIAS","email":"cnc"},{"elementId":329173,"pinned":false,"removed":false,"modelId":15781,"author":"s1","id":4516,"type":"ALIAS","email":""},{"elementId":329175,"pinned":false,"removed":false,"modelId":15781,"author":"","id":4517,"type":"ALIAS","email":"s13"},{"elementId":"883.81,380.41","pinned":true,"removed":false,"modelId":15781,"author":"xxx","id":4518,"type":"POINT","email":"xxx"},{"elementId":"241.01,372.35","pinned":true,"removed":true,"modelId":15781,"author":"","id":4290,"type":"POINT","email":""},{"elementId":"643.96,144.09","pinned":true,"removed":false,"modelId":15781,"author":"admin ","id":4291,"type":"POINT","email":""},{"elementId":"216.65,370.00","pinned":false,"removed":false,"modelId":15781,"author":"","id":4671,"type":"POINT","email":""},{"elementId":"214.10,368.00","pinned":true,"removed":false,"modelId":15781,"author":"a","id":4672,"type":"POINT","email":"z"},{"elementId":"82.84,598.00","pinned":true,"removed":true,"modelId":15781,"author":"admin ","id":4946,"type":"POINT","email":"piotr.gawron@uni.lu"},{"elementId":"219.20,112.00","pinned":true,"removed":true,"modelId":15781,"author":"admin ","id":4945,"type":"POINT","email":"piotr.gawron@uni.lu"},{"elementId":"386.15,494.00","pinned":false,"removed":true,"modelId":15781,"author":"x","id":4944,"type":"POINT","email":""},{"elementId":"497.02,465.00","pinned":false,"removed":true,"modelId":15781,"author":"x","id":4943,"type":"POINT","email":""},{"elementId":"457.51,472.00","pinned":true,"removed":true,"modelId":15781,"author":"xxx3","id":4942,"type":"POINT","email":""},{"elementId":"681.81,523.00","pinned":true,"removed":true,"modelId":15781,"author":"xxx3","id":4941,"type":"POINT","email":""},{"elementId":"737.89,405.00","pinned":true,"removed":true,"modelId":15781,"author":"xxx3","id":4940,"type":"POINT","email":""},{"elementId":"484.28,583.00","pinned":true,"removed":true,"modelId":15781,"author":"xxx2","id":4939,"type":"POINT","email":""},{"elementId":"144.01,518.00","pinned":true,"removed":true,"modelId":15781,"author":"xxx","id":4938,"type":"POINT","email":""},{"elementId":153503,"pinned":true,"removed":true,"modelId":15781,"author":"1","id":4674,"type":"REACTION","email":"2"},{"elementId":329178,"pinned":true,"removed":true,"modelId":15781,"author":"","id":4673,"type":"ALIAS","email":""},{"elementId":"224.30,556.00","pinned":false,"removed":false,"modelId":15781,"author":"admin ","id":4947,"type":"POINT","email":"piotr.gawron@uni.lu"},{"elementId":"291.84,559.00","pinned":false,"removed":false,"modelId":15781,"author":"admin ","id":4948,"type":"POINT","email":"piotr.gawron@uni.lu"},{"elementId":"345.37,546.00","pinned":false,"removed":false,"modelId":15781,"author":"admin ","id":4949,"type":"POINT","email":"piotr.gawron@uni.lu"},{"elementId":"458.79,598.00","pinned":false,"removed":false,"modelId":15781,"author":"admin ","id":4950,"type":"POINT","email":"piotr.gawron@uni.lu"},{"elementId":"786.31,586.00","pinned":false,"removed":false,"modelId":15781,"author":"admin ","id":4951,"type":"POINT","email":"piotr.gawron@uni.lu"},{"elementId":"570.94,474.00","pinned":true,"removed":false,"modelId":15781,"author":"admin ","id":4952,"type":"POINT","email":"piotr.gawron@uni.lu"},{"elementId":"607.90,463.00","pinned":true,"removed":false,"modelId":15781,"author":" s","id":4956,"type":"POINT","email":""},{"elementId":"607.90,463.00","pinned":true,"removed":false,"modelId":15781,"author":" s","id":4957,"type":"POINT","email":""},{"elementId":"607.90,463.00","pinned":true,"removed":false,"modelId":15781,"author":" s","id":4958,"type":"POINT","email":""},{"elementId":"1199.22,26.00","pinned":true,"removed":false,"modelId":15781,"author":" x","id":4959,"type":"POINT","email":""},{"elementId":"71.37,36.00","pinned":false,"removed":false,"modelId":15781,"author":"admin ","id":4961,"type":"POINT","email":"piotr.gawron@uni.lu"},{"elementId":329173,"pinned":false,"removed":false,"modelId":15781,"author":"admin ","id":4962,"type":"ALIAS","email":""},{"elementId":329179,"pinned":false,"removed":false,"modelId":15781,"author":"admin ","id":4963,"type":"ALIAS","email":""},{"elementId":329157,"pinned":true,"removed":false,"modelId":15781,"author":"admin ","id":4964,"type":"ALIAS","email":"piotr.gawron@uni.lu"},{"elementId":153510,"pinned":false,"removed":false,"modelId":15781,"author":"admin ","id":4965,"type":"REACTION","email":"piotr.gawron@uni.lu"},{"elementId":"477.91,184.00","pinned":false,"removed":false,"modelId":15781,"author":"","id":4966,"type":"POINT","email":""}] \ No newline at end of file -- GitLab