rework users page, add role assignment
This commit is contained in:
parent
9998e00ae3
commit
80d48ed7d8
13 changed files with 118 additions and 72 deletions
10
app/views/admin/users/_user_roles.html.haml
Normal file
10
app/views/admin/users/_user_roles.html.haml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
- user ||= @user
|
||||
.roles{ id: 'current_roles' }
|
||||
= semantic_form_for(user, url: admin_user_path(user)) do |f|
|
||||
= f.action :submit, as: :button, label: 'Update Roles', button_html: {value: 'Save', class: 'btn btn-primary'}
|
||||
= f.inputs "Roles for #{@user.name}" do
|
||||
- user.roles.each do |role|
|
||||
%br
|
||||
= hidden_field_tag "user[role_ids][]", nil
|
||||
= check_box_tag "user[role_ids][]", role.id, user.roles.include?(role), id: dom_id(role)
|
||||
= label_tag dom_id(role), "#{ role.name.capitalize } for #{ role.resource_type.constantize.find(role.resource_id).short_title }"
|
||||
Loading…
Add table
Add a link
Reference in a new issue