Commit bec2b92d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

listener for removal confirmation is added on object creation not refresh

parent c527f9db
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())];
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment