2016-09-13 17:45:13 +05:30
|
|
|
- show_roles = local_assigns.fetch(:show_roles, true)
|
2016-06-16 23:09:34 +05:30
|
|
|
- show_controls = local_assigns.fetch(:show_controls, true)
|
2017-09-10 17:25:29 +05:30
|
|
|
- force_mobile_view = local_assigns.fetch(:force_mobile_view, false)
|
2016-11-03 12:29:30 +05:30
|
|
|
- user = local_assigns.fetch(:user, member.user)
|
|
|
|
- source = member.source
|
|
|
|
- can_admin_member = can?(current_user, action_member_permission(:update, member), member)
|
2016-06-16 23:09:34 +05:30
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
%li.member{ class: dom_class(member), id: dom_id(member) }
|
|
|
|
%span.list-item-name
|
2016-08-24 12:49:21 +05:30
|
|
|
- if user
|
|
|
|
= image_tag avatar_icon(user, 40), class: "avatar s40", alt: ''
|
2017-09-10 17:25:29 +05:30
|
|
|
.user-info
|
|
|
|
= link_to user.name, user_path(user), class: 'member'
|
|
|
|
%span.cgray= user.to_reference
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
- if user == current_user
|
|
|
|
%span.label.label-success.prepend-left-5 It's you
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
- if user.blocked?
|
|
|
|
%label.label.label-danger
|
|
|
|
%strong Blocked
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
- if source.instance_of?(Group) && source != @group
|
|
|
|
·
|
|
|
|
= link_to source.full_name, source, class: "member-group-link"
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
.cgray
|
|
|
|
- if member.request?
|
|
|
|
Requested
|
|
|
|
= time_ago_with_tooltip(member.requested_at)
|
|
|
|
- else
|
|
|
|
Joined #{time_ago_with_tooltip(member.created_at)}
|
|
|
|
- if member.expires?
|
|
|
|
·
|
|
|
|
%span{ class: "#{"text-warning" if member.expires_soon?} has-tooltip", title: member.expires_at.to_time.in_time_zone.to_s(:medium) }
|
|
|
|
Expires in #{distance_of_time_in_words_to_now(member.expires_at)}
|
2016-08-24 12:49:21 +05:30
|
|
|
|
|
|
|
- else
|
|
|
|
= image_tag avatar_icon(member.invite_email, 40), class: "avatar s40", alt: ''
|
2017-09-10 17:25:29 +05:30
|
|
|
.user-info
|
|
|
|
.member= member.invite_email
|
|
|
|
.cgray
|
|
|
|
Invited
|
|
|
|
- if member.created_by
|
|
|
|
by
|
|
|
|
= link_to member.created_by.name, user_path(member.created_by)
|
|
|
|
= time_ago_with_tooltip(member.created_at)
|
2016-08-24 12:49:21 +05:30
|
|
|
- if show_roles
|
2017-08-17 22:00:37 +05:30
|
|
|
- current_resource = @project || @group
|
2016-11-03 12:29:30 +05:30
|
|
|
.controls.member-controls
|
2017-08-17 22:00:37 +05:30
|
|
|
- if show_controls && member.source == current_resource
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
- if member.invite? && can?(current_user, action_member_permission(:admin, member), member.source)
|
|
|
|
= link_to icon('paper-plane'), polymorphic_path([:resend_invite, member]),
|
|
|
|
method: :post,
|
|
|
|
class: 'btn btn-default prepend-left-10 hidden-xs',
|
|
|
|
title: 'Resend invite'
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
- if user != current_user && can_admin_member
|
2016-11-03 12:29:30 +05:30
|
|
|
= form_for member, remote: true, html: { class: 'form-horizontal js-edit-member-form' } do |f|
|
2017-08-17 22:00:37 +05:30
|
|
|
= f.hidden_field :access_level
|
|
|
|
.member-form-control.dropdown.append-right-5
|
|
|
|
%button.dropdown-menu-toggle.js-member-permissions-dropdown{ type: "button",
|
|
|
|
disabled: !can_admin_member,
|
|
|
|
data: { toggle: "dropdown", field_name: "#{f.object_name}[access_level]" } }
|
|
|
|
%span.dropdown-toggle-text
|
|
|
|
= member.human_access
|
|
|
|
= icon("chevron-down")
|
|
|
|
.dropdown-menu.dropdown-select.dropdown-menu-align-right.dropdown-menu-selectable
|
|
|
|
= dropdown_title("Change permissions")
|
|
|
|
.dropdown-content
|
|
|
|
%ul
|
|
|
|
- member.class.access_level_roles.each do |role, role_id|
|
|
|
|
%li
|
|
|
|
= link_to role, "javascript:void(0)",
|
|
|
|
class: ("is-active" if member.access_level == role_id),
|
|
|
|
data: { id: role_id, el_id: dom_id(member) }
|
2016-11-03 12:29:30 +05:30
|
|
|
.prepend-left-5.clearable-input.member-form-control
|
2017-08-17 22:00:37 +05:30
|
|
|
= f.text_field :expires_at, class: 'form-control js-access-expiration-date js-member-update-control', placeholder: 'Expiration date', id: "member_expires_at_#{member.id}", disabled: !can_admin_member, data: { el_id: dom_id(member) }
|
2016-09-13 17:45:13 +05:30
|
|
|
%i.clear-icon.js-clear-input
|
2016-11-03 12:29:30 +05:30
|
|
|
- else
|
|
|
|
%span.member-access-text= member.human_access
|
|
|
|
|
|
|
|
- if member.invite? && can?(current_user, action_member_permission(:admin, member), member.source)
|
|
|
|
= link_to 'Resend invite', polymorphic_path([:resend_invite, member]),
|
|
|
|
method: :post,
|
2017-09-10 17:25:29 +05:30
|
|
|
class: 'btn btn-default prepend-left-10 visible-xs-block'
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
- elsif member.request? && can_admin_member
|
2017-09-10 17:25:29 +05:30
|
|
|
= link_to polymorphic_path([:approve_access_request, member]),
|
2016-11-03 12:29:30 +05:30
|
|
|
method: :post,
|
|
|
|
class: 'btn btn-success prepend-left-10',
|
2017-09-10 17:25:29 +05:30
|
|
|
title: 'Grant access' do
|
|
|
|
%span{ class: ('visible-xs-block' unless force_mobile_view) }
|
|
|
|
Grant access
|
|
|
|
- unless force_mobile_view
|
|
|
|
= icon('check inverse', class: 'hidden-xs')
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
- if can?(current_user, action_member_permission(:destroy, member), member)
|
|
|
|
- if current_user == user
|
|
|
|
= link_to icon('sign-out', text: 'Leave'), polymorphic_path([:leave, member.source, :members]),
|
|
|
|
method: :delete,
|
|
|
|
data: { confirm: leave_confirmation_message(member.source) },
|
|
|
|
class: 'btn btn-remove prepend-left-10'
|
|
|
|
- else
|
|
|
|
= link_to member,
|
|
|
|
remote: true,
|
|
|
|
method: :delete,
|
|
|
|
data: { confirm: remove_member_message(member) },
|
|
|
|
class: 'btn btn-remove prepend-left-10',
|
|
|
|
title: remove_member_title(member) do
|
2017-09-10 17:25:29 +05:30
|
|
|
%span{ class: ('visible-xs-block' unless force_mobile_view) }
|
2016-11-03 12:29:30 +05:30
|
|
|
Delete
|
2017-09-10 17:25:29 +05:30
|
|
|
- unless force_mobile_view
|
|
|
|
= icon('trash', class: 'hidden-xs')
|
2016-11-03 12:29:30 +05:30
|
|
|
- else
|
|
|
|
%span.member-access-text= member.human_access
|