Implemented ability of admins to manually confirm users
This commit is contained in:
parent
6c2dc92b84
commit
c50e8c0466
7 changed files with 90 additions and 16 deletions
|
|
@ -1,5 +1,22 @@
|
|||
= semantic_form_for [:admin, @user] do |f|
|
||||
= f.inputs 'Basic Information' do
|
||||
.pull-right
|
||||
%b
|
||||
Confirmed?
|
||||
- if can? :toggle_confirmation, @user
|
||||
= check_box_tag @user.id, @user.id, @user.confirmed?,
|
||||
method: :patch,
|
||||
url: "/admin/users/#{@user.id}/toggle_confirmation?user[to_confirm]=",
|
||||
class: 'switch-checkbox',
|
||||
readonly: false,
|
||||
data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
|
||||
- else
|
||||
= check_box_tag @user.id, @user.id, @user.confirmed?,
|
||||
method: :patch,
|
||||
url: "/admin/users/#{@user.id}/toggle_confirmation?user[to_confirm]=",
|
||||
class: 'switch-checkbox',
|
||||
readonly: true,
|
||||
data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
|
||||
= f.input :is_admin, hint: 'An admin can create a new conference, manage users and make other users admins.'
|
||||
= f.input :name, :as => :string
|
||||
= f.input :email
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
%table.table.table-striped.table-bordered.table-hover.datatable
|
||||
%thead
|
||||
%th ID
|
||||
%th State
|
||||
%th Confirmed?
|
||||
%th Email
|
||||
%th Name
|
||||
%th Attended Conferences
|
||||
|
|
@ -23,10 +23,20 @@
|
|||
%td
|
||||
= user.id
|
||||
%td
|
||||
- if user.confirmed?
|
||||
confirmed
|
||||
- if can? :toggle_confirmation, user
|
||||
= check_box_tag user.id, user.id, user.confirmed?,
|
||||
method: :patch,
|
||||
url: "/admin/users/#{user.id}/toggle_confirmation?user[to_confirm]=",
|
||||
class: 'switch-checkbox',
|
||||
readonly: false,
|
||||
data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
|
||||
- else
|
||||
unconfirmed
|
||||
= check_box_tag user.id, user.id, user.confirmed?,
|
||||
method: :patch,
|
||||
url: "/admin/users/#{user.id}/toggle_confirmation?user[to_confirm]=",
|
||||
class: 'switch-checkbox',
|
||||
readonly: true,
|
||||
data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
|
||||
%td
|
||||
= user.email
|
||||
%td
|
||||
|
|
|
|||
|
|
@ -14,12 +14,6 @@
|
|||
- if can? :edit, @user
|
||||
.pull-right
|
||||
= link_to 'Edit', edit_admin_user_path(@user), class: 'btn btn-primary'
|
||||
- if @user.confirmed?
|
||||
%span.label.label-success
|
||||
confirmed
|
||||
- else
|
||||
%span.label.label-warning
|
||||
unconfirmed
|
||||
%table.table
|
||||
- @show_attributes.each do |attr|
|
||||
%tr
|
||||
|
|
@ -32,6 +26,28 @@
|
|||
- elsif attr == 'biography'
|
||||
%td
|
||||
= markdown(@user.biography)
|
||||
- elsif attr == 'email'
|
||||
%td
|
||||
= @user.send(attr)
|
||||
%tr
|
||||
%td
|
||||
%b
|
||||
Confirmed?
|
||||
%td
|
||||
- if can? :toggle_confirmation, @user
|
||||
= check_box_tag @user.id, @user.id, @user.confirmed?,
|
||||
method: :patch,
|
||||
url: "/admin/users/#{@user.id}/toggle_confirmation?user[to_confirm]=",
|
||||
class: 'switch-checkbox',
|
||||
readonly: false,
|
||||
data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
|
||||
- else
|
||||
= check_box_tag @user.id, @user.id, @user.confirmed?,
|
||||
method: :patch,
|
||||
url: "/admin/users/#{@user.id}/toggle_confirmation?user[to_confirm]=",
|
||||
class: 'switch-checkbox',
|
||||
readonly: true,
|
||||
data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
|
||||
- else
|
||||
%td= @user.send(attr)
|
||||
#submissions-content.tab-pane{class: "#{'active' if params[:tab] == 'submissions-content'}"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue