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 def toggle_admin
@user = find_user @user = find_user
@user.toggle_admin! @user.toggle_admin!
redirect_to :back
end end
def show def show

View File

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

View File

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