Admin toggling

This commit is contained in:
Andrew Radev 2015-05-30 16:34:49 +03:00
parent ea3c8e70fd
commit 32402b62e0
3 changed files with 11 additions and 5 deletions

View File

@ -7,6 +7,7 @@ module Management
def toggle_admin
@user = find_user
@user.toggle_admin!
redirect_to :back
end
def show

View File

@ -17,10 +17,11 @@
td= image_tag(user.profile_picture.thumb.url)
td= user.name
td.boolean-col
= link_to toggle_admin_management_user_path(user), method: :put do
- if user.admin?
= icon 'check-square-o'
.btn.btn-primary= icon('circle-o')
- else
= icon 'minus-square-o'
.btn.btn-success= icon('dot-circle-o')
td.actions
div.btn-group.btn-group-sm

View File

@ -10,7 +10,11 @@ Rails.application.routes.draw do
resources :sponsorship_offers
resource :call_for_participation, only: [:create, :destroy]
end
resources :users
resources :users do
member do
put :toggle_admin
end
end
end
root 'management/conferences#index'