add views for organization admin role

This commit is contained in:
shlok007 2017-08-22 17:25:34 +05:30 committed by Shlok Srivastava
parent db8fdb3d38
commit a91c67be0a
5 changed files with 59 additions and 1 deletions

View file

@ -78,6 +78,7 @@ linters:
- "app/views/admin/resources/show.html.haml"
- "app/views/admin/roles/_form.html.haml"
- "app/views/admin/roles/_users.html.haml"
- "app/views/admin/roles/_users_with_org_admin_role.haml"
- "app/views/admin/roles/index.html.haml"
- "app/views/admin/roles/show.html.haml"
- "app/views/admin/rooms/_form.html.haml"

View file

@ -0,0 +1,25 @@
.page-header
%h3 Users (#{users.length})
- if users.present?
%table.table.table-striped.table-bordered.table-hover.datatable#users
%thead
%th Name
%th Email
- if ( can? :unassign_org_admins, organization )
%th
Actions
%tbody
- users.each do |user|
%tr
%td= user.name
%td= user.email
- if ( can? :unassign_org_admins, organization )
%td
= link_to 'Remove from organization admin',
unassign_org_admins_admin_organization_path(organization.id,
role.name,
user: {email: user.email}),
method: :delete,
class: 'btn btn-danger'
- else
%h5 No users found!

View file

@ -25,6 +25,8 @@
= organization.conferences.past.count
%td
.btn-group
= link_to 'Admins', admins_admin_organization_path(organization),
method: :get, class: 'btn btn-success'
= link_to 'Edit', edit_admin_organization_path(organization),
method: :get, class: 'btn btn-primary'
= link_to 'Delete', admin_organization_path(organization),

View file

@ -0,0 +1,24 @@
.row
.col-md-12
.page-header
%h2
Organization admins for #{@organization.name}
.text-muted
= @role.description
.row.col-md-3
- if ( can? :assign_org_admins, @organization )
= semantic_form_for :user,
url: assign_org_admins_admin_organization_path(@organization,
@role.name), method: :post do |u|
= u.label 'Add user by email: '
.input-group
= u.input :email, label: false, placeholder: "User's email"
.input-group-btn
= u.submit 'Add', id: 'user-add', class: 'btn btn-primary'
.row
.col-md-12
= render partial: 'users_with_org_admin_role',
locals: { users: @users, organization: @organization, role: @role }

View file

@ -20,7 +20,13 @@ Osem::Application.routes.draw do
end
namespace :admin do
resources :organizations
resources :organizations do
member do
get :admins
post :assign_org_admins
delete :unassign_org_admins
end
end
resources :users do
member do
patch :toggle_confirmation