Messages de confirmation de suppression

This commit is contained in:
Fred Tempez 2020-07-06 12:14:13 +02:00
parent ef141d72bf
commit 3ea30e9268
1 changed files with 15 additions and 2 deletions

View File

@ -10,18 +10,31 @@
* @link http://zwiicms.com/
*/
/**
* Confirmation de suppression
*/
$(".blogCommentDelete").on("click", function() {
var _this = $(this);
return core.confirm("Êtes-vous sûr de vouloir supprimer ce commentaire ?", function() {
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
return core.confirm("Êtes-vous sûr de vouloir supprimer le commentaire de l'article " + nom + " ?", function() {
$(location).attr("href", _this.attr("href"));
});
});
/**
* Confirmation de suppression en masse
*/
$(".blogCommentDeleteAll").on("click", function() {
var _this = $(this);
return core.confirm("Êtes-vous sûr de vouloir supprimer les "+ <?php echo count($this->getData(['module',$this->getUrl(0), $this->getUrl(2), 'comment']));?>+" commentaires de l'article sélectionné ?", function() {
var nombre = "<?php echo count($this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment' ])); ?>";
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
if( nombre === "1"){
var message = "Êtes-vous sûr de vouloir supprimer le commentaire de l'article " + nom + " ?";
} else{
var message = "Êtes-vous sûr de vouloir supprimer les " + nombre + " commentaires de l'article " + nom + " ?";
}
return core.confirm(message, function() {
$(location).attr("href", _this.attr("href"));
});
});