From 514bcb851b31887b0a3401e4cd99a278133d73fd Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Thu, 19 Nov 2015 10:11:00 +0100 Subject: [PATCH] delete customers --- app/controllers/admin/customers_controller.rb | 10 ++++++++++ app/controllers/public/customers_controller.rb | 8 -------- app/views/admin/customers/_customer.html.haml | 4 ++-- app/views/admin/customers/destroy.js.erb | 3 +++ 4 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 app/views/admin/customers/destroy.js.erb diff --git a/app/controllers/admin/customers_controller.rb b/app/controllers/admin/customers_controller.rb index f8b0fb2..d8d79cf 100644 --- a/app/controllers/admin/customers_controller.rb +++ b/app/controllers/admin/customers_controller.rb @@ -47,5 +47,15 @@ class Admin::CustomersController < ApplicationController end + def destroy + + @customer = Customer.find(params[:id]) + @customer.destroy + + + + end + + end diff --git a/app/controllers/public/customers_controller.rb b/app/controllers/public/customers_controller.rb index 14b1693..cf12f0a 100644 --- a/app/controllers/public/customers_controller.rb +++ b/app/controllers/public/customers_controller.rb @@ -128,14 +128,6 @@ class Public::CustomersController < ApplicationController - def destroy - - #@customer = Customer.find(params[:id]) - #@customer.destroy - - - - end def mail diff --git a/app/views/admin/customers/_customer.html.haml b/app/views/admin/customers/_customer.html.haml index 4650fbc..8c3df45 100644 --- a/app/views/admin/customers/_customer.html.haml +++ b/app/views/admin/customers/_customer.html.haml @@ -18,8 +18,8 @@ =link_to customer.email, "mailto:#{customer.email}" - %td.actions - =# link_to i(:"trash-o"), [:admin, customer], :confirm => 'Voulez-vous vraiment supprimer ce compte utilisateur ?', :method => :delete, :remote => true + %td.actions{:style => "width:150px;"} + = link_to i(:"trash-o"), [:admin, customer], :data => {:confirm => 'Voulez-vous vraiment supprimer ce compte utilisateur ?'}, :method => :delete, :remote => true =# link_to i(:eye), [:admin, customer] = link_to i(:pencil), edit_admin_customer_path(customer) = link_to i(:check), validate_admin_customer_path(customer), :data => {:confirm => "Voulez-vous vraiment valider ce compte ?"} if !customer.account_validated diff --git a/app/views/admin/customers/destroy.js.erb b/app/views/admin/customers/destroy.js.erb new file mode 100644 index 0000000..23be850 --- /dev/null +++ b/app/views/admin/customers/destroy.js.erb @@ -0,0 +1,3 @@ +$('#customer_row_<%= @customer.id %>').remove(); + +close_pane_hover(); \ No newline at end of file