django-comments-xtd
django-comments-xtd copied to clipboard
add ability to reload comments after changing state
Few changes that allowed me to reload comments for different object after page load (for usage in modal dialog). I don't know anything about React, so the code is rather hacky, and with the version 3.0 on the way I think we don't need to put much effort into polishing this. I am putting it here just to show how I solved #335.
I am reloading the comments with:
$.getJSON(
"/asset-comment/" + asset_id + "/",
function(comments_props, textStatus, jqxhr) {
comments_props_override = {
allow_comments: true,
allow_feedback: true,
show_feedback: true,
allow_flagging: true,
polling_interval: 5000
};
window.commentBox.setState({props: Object.assign(comments_props, comments_props_override)});
window.commentBox.reload_all();
}
);
Where on the /asset-comment/xxxx/
url is view that just returns JSON with the comments_props
.