119 lines
5.1 KiB
Text
119 lines
5.1 KiB
Text
- show_roles = local_assigns.fetch(:show_roles, true)
|
|
- show_controls = local_assigns.fetch(:show_controls, true)
|
|
- force_mobile_view = local_assigns.fetch(:force_mobile_view, false)
|
|
- member = local_assigns.fetch(:member)
|
|
- user = local_assigns.fetch(:user, member.user)
|
|
- source = member.source
|
|
|
|
%li.member{ class: dom_class(member), id: dom_id(member) }
|
|
%span.list-item-name
|
|
- if user
|
|
= image_tag avatar_icon_for_user(user, 40), class: "avatar s40", alt: ''
|
|
.user-info
|
|
= link_to user.name, user_path(user), class: 'member'
|
|
= user_status(user)
|
|
%span.cgray= user.to_reference
|
|
|
|
- if user == current_user
|
|
%span.badge.badge-success.prepend-left-5 It's you
|
|
|
|
- if user.blocked?
|
|
%label.badge.badge-danger
|
|
%strong Blocked
|
|
|
|
- if user.two_factor_enabled?
|
|
%label.label.label-info
|
|
2FA
|
|
|
|
- if source.instance_of?(Group) && source != @group
|
|
·
|
|
= link_to source.full_name, source, class: "member-group-link"
|
|
|
|
.cgray
|
|
- if member.request?
|
|
Requested
|
|
= time_ago_with_tooltip(member.requested_at)
|
|
- else
|
|
Given access #{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)}
|
|
|
|
- else
|
|
= image_tag avatar_icon_for_email(member.invite_email, 40), class: "avatar s40", alt: ''
|
|
.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)
|
|
- if show_roles
|
|
- current_resource = @project || @group
|
|
.controls.member-controls
|
|
- if show_controls && member.source == current_resource
|
|
|
|
- if member.can_resend_invite?
|
|
= link_to icon('paper-plane'), polymorphic_path([:resend_invite, member]),
|
|
method: :post,
|
|
class: 'btn btn-default prepend-left-10 d-none d-sm-block',
|
|
title: 'Resend invite'
|
|
|
|
- if user != current_user && member.can_update?
|
|
= form_for member, remote: true, html: { class: 'js-edit-member-form form-group row append-right-5' } do |f|
|
|
= f.hidden_field :access_level
|
|
.member-form-control.dropdown.append-right-5
|
|
%button.dropdown-menu-toggle.js-member-permissions-dropdown{ type: "button",
|
|
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-right.dropdown-menu-selectable
|
|
= dropdown_title("Change permissions")
|
|
.dropdown-content
|
|
%ul
|
|
- member.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) }
|
|
.prepend-left-5.clearable-input.member-form-control
|
|
= 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}",
|
|
data: { el_id: dom_id(member) }
|
|
%i.clear-icon.js-clear-input
|
|
- else
|
|
%span.member-access-text= member.human_access
|
|
|
|
- if member.can_approve?
|
|
= link_to polymorphic_path([:approve_access_request, member]),
|
|
method: :post,
|
|
class: 'btn btn-success prepend-left-10',
|
|
title: 'Grant access' do
|
|
%span{ class: ('d-block d-sm-none' unless force_mobile_view) }
|
|
Grant access
|
|
- unless force_mobile_view
|
|
= icon('check inverse', class: 'd-none d-sm-block')
|
|
|
|
- if member.can_remove?
|
|
- 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,
|
|
method: :delete,
|
|
data: { confirm: remove_member_message(member) },
|
|
class: 'btn btn-remove prepend-left-10',
|
|
title: remove_member_title(member) do
|
|
%span{ class: ('d-block d-sm-none' unless force_mobile_view) }
|
|
Delete
|
|
- unless force_mobile_view
|
|
= icon('trash', class: 'd-none d-sm-block')
|
|
- else
|
|
%span.member-access-text= member.human_access
|