Skip to content
Snippets Groups Projects
Commit eb123891 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '697-deleting-comments' into 'devel_12.2.x'

listener for removal confirmation is added on object creation not refresh

See merge request !673
parents c527f9db bec2b92d
No related branches found
No related tags found
4 merge requests!678Merge 12.2.0 beta.2 into master,!67712.2.0~beta.2 into master,!676Devel 12.2.0~beta.2 into master,!673listener for removal confirmation is added on object creation not refresh
Pipeline #9007 passed
minerva (12.2.0~beta.2) unstable; urgency=medium
* Bug fix: removing comments in a project asked for confirmation twice after
edit project dialog for specific project was opened; closed and opened
again (#697)
* Bug fix: clicking on compartment border inside pathway should return
compartment, not a pathway (#324)
* Bug fix: clicking outside of the element sometimes resulted with the
......
......@@ -66,6 +66,25 @@ CommentsAdminPanel.prototype._createGui = function () {
}]
});
$("[name='commentsTable']", self.getElement()).on("click", "[name='removeComment']", function () {
var button = this;
return self.askConfirmRemoval({
title: "Why do you want to remove this comment?",
input: true
}).then(function (param) {
if (param.status) {
return ServerConnector.removeComment({
commentId: $(button).attr("data"),
reason: param.reason,
projectId: self.getProject().getProjectId()
}).then(function () {
$(button).after("<span>YES (" + param.reason + ")</span>");
button.style.display = "none";
});
}
}).catch(GuiConnector.alert)
});
};
/**
......@@ -93,24 +112,6 @@ CommentsAdminPanel.prototype.refreshComments = function () {
data.push(self.commentToTableRow(comments[i]));
}
dataTable.clear().rows.add(data).draw();
$("[name='commentsTable']", self.getElement()).on("click", "[name='removeComment']", function () {
var button = this;
return self.askConfirmRemoval({
title: "Why do you want to remove this comment?",
input: true
}).then(function (param) {
if (param.status) {
return ServerConnector.removeComment({
commentId: $(button).attr("data"),
reason: param.reason,
projectId: self.getProject().getProjectId()
}).then(function () {
$(button).after("<span>YES (" + param.reason + ")</span>");
button.style.display = "none";
});
}
}).catch(GuiConnector.alert)
});
});
};
......@@ -131,10 +132,10 @@ CommentsAdminPanel.prototype.commentToTableRow = function (comment) {
};
var title = null;
if (!comment.isRemoved()) {
var commentLink = "index.xhtml?id=" + projectId +
"&x=" + comment.getCoordinates().x +
"&y=" + comment.getCoordinates().y +
"&zoom=12" +
var commentLink = "index.xhtml?id=" + projectId +
"&x=" + comment.getCoordinates().x +
"&y=" + comment.getCoordinates().y +
"&zoom=12" +
"&comments=on";
title = "<a href='" + commentLink + "' target='" + projectId + "'>" + comment.getTitle() + "</a>";
} else {
......@@ -158,12 +159,12 @@ CommentsAdminPanel.prototype.commentToTableRow = function (comment) {
email = "N/A";
}
return [comment.getId(),
xss(title),
xss(author),
xss(email),
xss(comment.getContent()),
remove,
return [comment.getId(),
xss(title),
xss(author),
xss(email),
xss(comment.getContent()),
remove,
toYesNo(comment.isPinned())];
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment