diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index e49c02f5..0cfdfd82 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -66,6 +66,12 @@ module Admin def edit; end + def delete + @user.destroy! + flash[:notice] = "User #{@user.id} (#{@user.emai}) successfully deleted." + redirect_to admin_users_path + end + private def user_params diff --git a/app/datatables/user_datatable.rb b/app/datatables/user_datatable.rb index 45200ebb..cc29e995 100644 --- a/app/datatables/user_datatable.rb +++ b/app/datatables/user_datatable.rb @@ -35,7 +35,8 @@ class UserDatatable < AjaxDatatablesRails::Base roles: record.roles.any? ? show_roles(record.get_roles) : 'None', view_url: admin_user_path(record), edit_url: edit_admin_user_path(record), - DT_RowId: record.id + DT_RowId: record.id, + confirmed: record.confirmed_at.present? } end end diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 6e2c13df..5e3d8894 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -20,6 +20,7 @@ %th{ width: '0' } Conferences Attended %th{ width: '50%' } Roles %th{ width: '0' } Actions + %th{ style: 'display: none' } Confirmed? %tbody :javascript @@ -37,6 +38,7 @@ { "data": "confirmed_at", "render": function (data, type, row, meta) { + console.log(meta) return 'Edit'+ ''; } + }, + { + "data": "confirmed", + "className": 'sr-only', + "render": false } ] });