mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-27 14:29:22 +00:00
40 lines
953 B
JavaScript
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);
|
||
|
|
||
|
});
|
||
|
|
||
|
}
|
||
|
|
||
|
};
|