Browse Source

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

dev
Guillaume Bourgeois 5 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

}, },
'delete' => function($url, $model) { '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())), [ 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

opendistrib_tooltip() ; opendistrib_tooltip() ;
opendistrib_ordre_produits() ; opendistrib_ordre_produits() ;
opendistrib_products() ; opendistrib_products() ;
opendistrib_confirm_delete() ;
}) ; }) ;


var UrlManager = { 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() { function opendistrib_products() {
if($('.product-create').size() || $('.product-update').size()) { if($('.product-create').size() || $('.product-update').size()) {
opendistrib_products_event_unit(false) ; opendistrib_products_event_unit(false) ;

Loading…
Cancel
Save