ComunicWeb/assets/js/components/comments/actions.js
2018-01-27 18:49:05 +01:00

40 lines
953 B
JavaScript

/**
* 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){
ComunicWeb.common.notificationSystem.showNotification("Couldn't get informations about a comment !", "danger");
return;
}
//Apply new informations about the comment
//Display new comment informations
ComunicWeb.components.comments.ui.display_comment(result, target);
});
}
};