From d226331f194a0087164b59037e8e9492278d5133 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sun, 20 Aug 2023 15:23:35 +0200 Subject: [PATCH] Avertissement sur suppression de profil --- core/module/user/user.php | 7 ++---- core/module/user/view/profil/profil.js.php | 25 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 core/module/user/view/profil/profil.js.php diff --git a/core/module/user/user.php b/core/module/user/user.php index e7756ed8..8b2527b5 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -492,14 +492,11 @@ class user extends common helper::translate($groupData['name']), nl2br(helper::translate($groupData['comment'])), template::button('profilEdit' . $groupId, [ - 'href' => helper::baseUrl() . 'user/profilEdit/' . $groupId, 'value' => template::ico('pencil'), 'help' => 'Éditer', 'disabled' => $groupData['readonly'], ]), - template::button('permissionDelete' . $groupId, [ - 'class' => 'userDelete buttonRed', - 'href' => helper::baseUrl() . 'user/permissionDelete/' . $groupId, + template::button('profilDelete' . $groupId, [ 'value' => template::ico('trash'), 'help' => 'Supprimer', 'disabled' => $groupData['readonly'], @@ -522,7 +519,7 @@ class user extends common 'disabled' => $profilData['readonly'], ]), template::button('profilDelete' . $groupId . $profilId, [ - 'class' => 'userDelete buttonRed', + 'class' => 'profilDelete buttonRed', 'href' => helper::baseUrl() . 'user/profilDelete/' . $groupId . '/' . $profilId, 'value' => template::ico('trash'), 'help' => 'Supprimer', diff --git a/core/module/user/view/profil/profil.js.php b/core/module/user/view/profil/profil.js.php new file mode 100644 index 00000000..f6fecdc9 --- /dev/null +++ b/core/module/user/view/profil/profil.js.php @@ -0,0 +1,25 @@ +/** + * This file is part of Zwii. + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2023, Frédéric Tempez + * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International + * @link http://zwiicms.fr/ + */ + +$(document).ready(function () { + /** + * Confirmation de suppression + */ + $(".profilDelete").on("click", function () { + var _this = $(this); + var message = ""; + return core.confirm(message, function () { + $(location).attr("href", _this.attr("href")); + }); + }); +}); \ No newline at end of file