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); $(document).ready(destroy_action);
function destroy_action(){ function destroy_action(){
$("#destroy").on('click', function(){ $(".delete").on('click', function(){
$("#destroy").hide(); $(this).hide();
$("#confirm").show(); $(this).closest('td').find(".confirm").show();
}); });
$("#confirm #cancel").on('click', function(){ $(".cancel").on('click', function(){
$("#destroy").show(); $(this).closest('td').find(".delete").show();
$("#confirm").hide(); $(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; display: none;
} }
.confirm {
display: none;
}
.fa { .fa {
width: 15px; width: 15px;
text-align: center; text-align: center;

View file

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

View file

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