rosa-build/app/views/shared/_members_table.html.slim

83 lines
3.4 KiB
Plaintext

- update_roles_path ||= false
rd-widget
rd-widget-header title=t("layout.collaborators.members")
rd-widget-body
= form_tag remove_members_path, id: 'members_form', method: :delete do
table.table.table-striped
thead
tr
- if policy(editable_object).remove_members?
th
th
= t("layout.collaborators.members")
- if policy(editable_object).remove_members?
- if update_roles_path
th.buttons.text-center colspan=3
= t("layout.collaborators.roles")
th.buttons
= t("layout.remove")
tbody
- if update_roles_path
- actors ||= editable_object.actors
- members.each do |user|
tr
- if policy(editable_object).remove_members?
td
= check_box_tag "members[]", user.id
td
span
= image_tag avatar_url(user), size: '30x30'
|  
= link_to user.fullname, user_path(user)
- if policy(editable_object).remove_members?
- if update_roles_path
- actor = actors.find{ |a| a.actor_id == user.id }
- Relation::ROLES.each_with_index do |role, i|
td ng-init="user_#{user.id}_role = '#{actor.role}'"
input[
type = 'radio'
ng-model = "user_#{user.id}_role"
value = role ]
|  
= t("layout.collaborators.role_names.#{ role }")
td
- if update_roles_path
- path = "#{update_roles_path}?member_id=#{user.id}"
a[
ng-href = "{{'#{path}&role=' + user_#{user.id}_role}}"
data-method = 'put'
data-confirm = t('layout.confirm') ]
span.glyphicon.glyphicon-ok
|  
= link_to "#{remove_members_path}?members=#{user.id}", method: :delete, data: { confirm: t("layout.confirm") } do
span.glyphicon.glyphicon-remove
|  
- if policy(editable_object).remove_members?
= submit_tag t('layout.delete'), class: 'btn btn-danger', data: {'disable-with' => t('layout.processing')}
- if policy(editable_object).add_member?
rd-widget-footer
= simple_form_for :user, url: add_member_path,
html: { class: 'form-inline', ng_controller:"MembersController" },
wrapper: :inline_form do |f|
= hidden_field_tag 'member_id', nil, value: '{{memberId}}'
- autocomplete_path ||= autocomplete_user_uname_autocompletes_path
= f.input :uname,
input_html: { uib_typeahead: 'user.name for user in getUsers($viewValue)',
typeahead_on_select: 'select($item, $model, $label)',
ng_model: 'member' }
- if update_roles_path
|  
= f.input :role,
collection: options_for_collaborators_roles_select,
input_html: { name: :role },
include_blank: false
|  
= f.button :submit, t('layout.add')