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

83 lines
3.4 KiB
Plaintext
Raw Permalink Normal View History

2014-11-11 23:50:15 +00:00
- update_roles_path ||= false
2016-05-22 13:25:00 +01:00
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?
2014-11-11 23:50:15 +00:00
- if update_roles_path
2016-05-22 13:25:00 +01:00
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') ]
2014-11-11 23:50:15 +00:00
2016-05-22 13:25:00 +01:00
span.glyphicon.glyphicon-ok
|  
2014-11-11 23:50:15 +00:00
2016-05-22 13:25:00 +01:00
= link_to "#{remove_members_path}?members=#{user.id}", method: :delete, data: { confirm: t("layout.confirm") } do
span.glyphicon.glyphicon-remove
|  
2012-09-11 17:02:09 +01:00
2016-05-22 13:25:00 +01:00
- if policy(editable_object).remove_members?
= submit_tag t('layout.delete'), class: 'btn btn-danger', data: {'disable-with' => t('layout.processing')}
2014-11-10 22:21:48 +00:00
2016-05-22 13:25:00 +01:00
- 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|
2014-11-10 22:21:48 +00:00
2016-05-22 13:25:00 +01:00
= 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' }
2014-11-10 22:21:48 +00:00
2016-05-22 13:25:00 +01:00
- if update_roles_path
|  
= f.input :role,
collection: options_for_collaborators_roles_select,
input_html: { name: :role },
include_blank: false
2014-11-11 23:50:15 +00:00
2016-05-22 13:25:00 +01:00
|  
= f.button :submit, t('layout.add')