Fiabilisation de la suppression des gestionnaires par un administrateur

This commit is contained in:
Xavier J 2016-03-16 10:55:03 +01:00
parent bd61a459fb
commit 5d13276446
4 changed files with 23 additions and 18 deletions

View file

@ -2,13 +2,17 @@ $(document).on('page:load', destroy_action);
$(document).ready(destroy_action);
function destroy_action(){
$("#destroy").on('click', function(){
$("#destroy").hide();
$("#confirm").show();
$(".delete").on('click', function(){
$(this).hide();
$(this).closest('td').find(".confirm").show();
});
$("#confirm #cancel").on('click', function(){
$("#destroy").show();
$("#confirm").hide();
$(".cancel").on('click', function(){
$(this).closest('td').find(".delete").show();
$(this).closest('td').find(".confirm").hide();
});
$("#liste_gestionnaire #libelle").on('click', function(){
setTimeout(destroy_action, 500);
});
}

View file

@ -231,6 +231,10 @@ div.pagination {
display: none;
}
.confirm {
display: none;
}
.fa {
width: 15px;
text-align: center;

View file

@ -1,21 +1,18 @@
- unless smart_listing.empty?
%table.table
%table.table#liste_gestionnaire
%thead
%th#libelle= smart_listing.sortable 'Email', 'email'
%th= ''
- @gestionnaires.each do |gestionnaire|
%tr
%td= gestionnaire.email
%td{style:'padding-top: 11px; font-size:15px'}= gestionnaire.email
%td{ style: 'text-align:right' }
%span#destroy{ class: "fa fa-times" }
#confirm
=link_to(admin_gestionnaire_path(id: gestionnaire.id), method: :delete) do
%span#valid{ class: "fa fa-check btn-success" }
%span#valid
Valider
%span
|
%span#cancel{ class: "fa fa-minus btn-danger" }
.delete.btn.btn-sm.glyphicon.glyphicon-remove
.confirm
=link_to 'Valider', admin_gestionnaire_path(id: gestionnaire.id), {method: :delete, class: 'btn btn-sm btn-success'}
.cancel.btn.btn-sm.btn-danger.glyphicon.glyphicon-minus{style: 'top: 0'}
= smart_listing.paginate
= smart_listing.pagination_per_page_links

View file

@ -7,7 +7,7 @@
.col-md-1.col-lg-1
 
.col-md-6.col-lg-6
%h3 Ajouter un gestionnaire
%h3 Ajouter un accompagnateur
#procedure_new.section.section-label
= form_for @gestionnaire, url: {controller: 'admin/gestionnaires', action: :create} do |f|
.row