Browse Source

[backend] Utilisateurs : ajout d'une confirmation avant la suppression d'un utilisateur

refactoring
Guillaume Bourgeois 4 years ago
parent
commit
e9a1e788b5
2 changed files with 11 additions and 1 deletions
  1. +1
    -1
      backend/views/user/index.php
  2. +10
    -0
      backend/web/js/backend.js

+ 1
- 1
backend/views/user/index.php View File

@@ -162,7 +162,7 @@ $this->render('_menu',[
},
'delete' => function($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span>', Yii::$app->urlManager->createUrl(array_merge(['user/delete','id' => $model->id], Yii::$app->getRequest()->getQueryParams())), [
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default btn-confirm-delete'
]);
}
],

+ 10
- 0
backend/web/js/backend.js View File

@@ -42,6 +42,7 @@ $(document).ready(function() {
opendistrib_tooltip() ;
opendistrib_ordre_produits() ;
opendistrib_products() ;
opendistrib_confirm_delete() ;
}) ;

var UrlManager = {
@@ -54,6 +55,15 @@ var UrlManager = {
}
};

function opendistrib_confirm_delete() {
$('.btn-confirm-delete').click(function(event) {
if(!confirm('Souhaitez-vous vraiment supprimer cette entrée ?')) {
event.stopPropagation() ;
return false ;
}
}) ;
}

function opendistrib_products() {
if($('.product-create').size() || $('.product-update').size()) {
opendistrib_products_event_unit(false) ;

Loading…
Cancel
Save