ComunicWeb/assets/js/components/comments/actions.js

40 lines
952 B
JavaScript
Raw Permalink Normal View History

2018-01-27 17:49:05 +00:00
/**
* Comments actions
*
* @author Pierre HUBERT
*/
ComunicWeb.components.comments.actions = {
/**
* Reload a single comment
*
* @param {number} commentID The ID of the comment to reload
* @param {HTMLElement} target The target of the reloaded comment
*/
reload: function(commentID, target){
//Hide the comment to reload
target.style.visibility = "hidden";
//Get informations about the comment on the API server
ComunicWeb.components.comments.interface.get_single(commentID, function(result){
//Display again the comment to update
target.style.visibility = "visible";
//Check for errors
if(result.error){
2018-08-05 14:29:49 +00:00
ComunicWeb.common.notificationSystem.showNotification(lang("comments_actions_err_get_info_single"), "danger");
2018-01-27 17:49:05 +00:00
return;
}
//Apply new informations about the comment
//Display new comment informations
ComunicWeb.components.comments.ui.display_comment(result, target);
});
}
};