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)
|
2018-03-17 18:26:18 +05:30
|
|
|
- member = local_assigns.fetch(:member)
|
2016-11-03 12:29:30 +05:30
|
|
|
- user = local_assigns.fetch(:user, member.user)
|
|
|
|
- source = member.source
|
2019-09-04 21:01:54 +05:30
|
|
|
- override = member.try(:override)
|
2016-06-16 23:09:34 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
-# Note this is just for individual members. For groups please see shared/members/_group
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
%li.member.py-2.px-3.d-flex.flex-column{ class: [dom_class(member), ("is-overridden" if override), ("flex-md-row" unless force_mobile_view)], id: dom_id(member), data: { qa_selector: 'member_row' } }
|
2019-09-04 21:01:54 +05:30
|
|
|
%span.list-item-name.mb-2.m-md-0
|
2016-08-24 12:49:21 +05:30
|
|
|
- if user
|
2019-09-04 21:01:54 +05:30
|
|
|
= image_tag avatar_icon_for_user(user, 40), class: "avatar s40 flex-shrink-0 flex-grow-0", alt: ''
|
2017-09-10 17:25:29 +05:30
|
|
|
.user-info
|
2019-02-15 15:39:39 +05:30
|
|
|
= link_to user.name, user_path(user), class: 'member js-user-link', data: { user_id: user.id }
|
2018-11-18 11:00:15 +05:30
|
|
|
= user_status(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
%span.cgray= user.to_reference
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
= render_if_exists 'shared/members/ee/sso_badge', member: member
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
- if user == current_user
|
2019-02-15 15:39:39 +05:30
|
|
|
%span.badge.badge-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?
|
2018-11-08 19:23:39 +05:30
|
|
|
%label.badge.badge-danger
|
2019-02-15 15:39:39 +05:30
|
|
|
%strong= _("Blocked")
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
- if user.two_factor_enabled?
|
2018-12-05 23:21:45 +05:30
|
|
|
%label.badge.badge-info
|
2019-02-15 15:39:39 +05:30
|
|
|
= _("2FA")
|
2018-11-08 19:23:39 +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?
|
2019-02-15 15:39:39 +05:30
|
|
|
= _("Requested %{time_ago}").html_safe % { time_ago: time_ago_with_tooltip(member.requested_at) }
|
2017-09-10 17:25:29 +05:30
|
|
|
- else
|
2019-02-15 15:39:39 +05:30
|
|
|
= _("Given access %{time_ago}").html_safe % { time_ago: time_ago_with_tooltip(member.created_at) }
|
2017-09-10 17:25:29 +05:30
|
|
|
- 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) }
|
2019-02-15 15:39:39 +05:30
|
|
|
= _("Expires in %{expires_at}").html_safe % { expires_at: distance_of_time_in_words_to_now(member.expires_at) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
|
|
|
- else
|
2019-09-04 21:01:54 +05:30
|
|
|
= image_tag avatar_icon_for_email(member.invite_email, 40), class: "avatar s40 flex-shrink-0 flex-grow-0", 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
|
2019-09-04 21:01:54 +05:30
|
|
|
.controls.member-controls.align-items-center
|
|
|
|
= render_if_exists 'shared/members/ee/ldap_tag', can_override: member.can_override?
|
2017-08-17 22:00:37 +05:30
|
|
|
- if show_controls && member.source == current_resource
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
- if member.can_resend_invite?
|
2017-09-10 17:25:29 +05:30
|
|
|
= link_to icon('paper-plane'), polymorphic_path([:resend_invite, member]),
|
|
|
|
method: :post,
|
2019-09-04 21:01:54 +05:30
|
|
|
class: 'btn btn-default align-self-center mr-sm-2',
|
2019-02-15 15:39:39 +05:30
|
|
|
title: _('Resend invite')
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
- if user != current_user && member.can_update?
|
2019-09-04 21:01:54 +05:30
|
|
|
= form_for member, remote: true, html: { class: "js-edit-member-form form-group #{'d-sm-flex' unless force_mobile_view}" } do |f|
|
2017-08-17 22:00:37 +05:30
|
|
|
= f.hidden_field :access_level
|
2019-09-04 21:01:54 +05:30
|
|
|
.member-form-control.dropdown{ class: [("mr-sm-2 d-sm-inline-block" unless force_mobile_view)] }
|
2017-08-17 22:00:37 +05:30
|
|
|
%button.dropdown-menu-toggle.js-member-permissions-dropdown{ type: "button",
|
2019-09-04 21:01:54 +05:30
|
|
|
disabled: member.can_override? && !override,
|
2019-12-04 20:38:33 +05:30
|
|
|
data: { toggle: "dropdown", field_name: "#{f.object_name}[access_level]", qa_selector: "access_level_dropdown" } }
|
2017-08-17 22:00:37 +05:30
|
|
|
%span.dropdown-toggle-text
|
|
|
|
= member.human_access
|
|
|
|
= icon("chevron-down")
|
2018-11-08 19:23:39 +05:30
|
|
|
.dropdown-menu.dropdown-select.dropdown-menu-right.dropdown-menu-selectable
|
2019-02-15 15:39:39 +05:30
|
|
|
= dropdown_title(_("Change permissions"))
|
2017-08-17 22:00:37 +05:30
|
|
|
.dropdown-content
|
|
|
|
%ul
|
2019-02-15 15:39:39 +05:30
|
|
|
- member.valid_level_roles.each do |role, role_id|
|
2017-08-17 22:00:37 +05:30
|
|
|
%li
|
2019-12-04 20:38:33 +05:30
|
|
|
= link_to role, '#',
|
2017-08-17 22:00:37 +05:30
|
|
|
class: ("is-active" if member.access_level == role_id),
|
2019-12-04 20:38:33 +05:30
|
|
|
data: { id: role_id, el_id: dom_id(member), qa_selector: "#{role.downcase}_access_level_link" }
|
2019-09-04 21:01:54 +05:30
|
|
|
= render_if_exists 'shared/members/ee/revert_ldap_group_sync_option',
|
|
|
|
group: @group,
|
|
|
|
member: member,
|
|
|
|
can_override: member.can_override?
|
|
|
|
.clearable-input.member-form-control{ class: [("d-sm-inline-block" unless force_mobile_view)] }
|
2018-03-17 18:26:18 +05:30
|
|
|
= f.text_field :expires_at,
|
2019-09-04 21:01:54 +05:30
|
|
|
disabled: member.can_override? && !override,
|
2018-03-17 18:26:18 +05:30
|
|
|
class: 'form-control js-access-expiration-date js-member-update-control',
|
2019-02-15 15:39:39 +05:30
|
|
|
placeholder: _('Expiration date'),
|
2018-03-17 18:26:18 +05:30
|
|
|
id: "member_expires_at_#{member.id}",
|
|
|
|
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
|
2019-09-04 21:01:54 +05:30
|
|
|
%span.member-access-text.user-access-role= member.human_access
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
- if member.can_approve?
|
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,
|
2019-09-04 21:01:54 +05:30
|
|
|
class: "btn btn-success align-self-center m-0 mb-2 #{'mb-sm-0 ml-sm-2' unless force_mobile_view}",
|
2019-02-15 15:39:39 +05:30
|
|
|
title: _('Grant access') do
|
2018-11-08 19:23:39 +05:30
|
|
|
%span{ class: ('d-block d-sm-none' unless force_mobile_view) }
|
2019-02-15 15:39:39 +05:30
|
|
|
= _('Grant access')
|
2017-09-10 17:25:29 +05:30
|
|
|
- unless force_mobile_view
|
2018-11-08 19:23:39 +05:30
|
|
|
= icon('check inverse', class: 'd-none d-sm-block')
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
- if member.can_remove?
|
2016-11-03 12:29:30 +05:30
|
|
|
- if current_user == user
|
2019-02-15 15:39:39 +05:30
|
|
|
= link_to icon('sign-out', text: _('Leave')), polymorphic_path([:leave, member.source, :members]),
|
2016-11-03 12:29:30 +05:30
|
|
|
method: :delete,
|
|
|
|
data: { confirm: leave_confirmation_message(member.source) },
|
2019-09-04 21:01:54 +05:30
|
|
|
class: "btn btn-remove align-self-center m-0 #{'ml-sm-2' unless force_mobile_view}"
|
2016-11-03 12:29:30 +05:30
|
|
|
- else
|
|
|
|
= link_to member,
|
|
|
|
method: :delete,
|
2019-12-04 20:38:33 +05:30
|
|
|
data: { confirm: remove_member_message(member), qa_selector: 'delete_member_button' },
|
2019-09-04 21:01:54 +05:30
|
|
|
class: "btn btn-remove align-self-center m-0 #{'ml-sm-2' unless force_mobile_view}",
|
2016-11-03 12:29:30 +05:30
|
|
|
title: remove_member_title(member) do
|
2018-11-08 19:23:39 +05:30
|
|
|
%span{ class: ('d-block d-sm-none' unless force_mobile_view) }
|
2019-02-15 15:39:39 +05:30
|
|
|
= _("Delete")
|
2017-09-10 17:25:29 +05:30
|
|
|
- unless force_mobile_view
|
2018-11-08 19:23:39 +05:30
|
|
|
= icon('trash', class: 'd-none d-sm-block')
|
2019-09-04 21:01:54 +05:30
|
|
|
= render_if_exists 'shared/members/ee/override_member_buttons', group: @group, member: member, user: user, action: :edit, can_override: member.can_override?
|
2016-11-03 12:29:30 +05:30
|
|
|
- else
|
2019-09-04 21:01:54 +05:30
|
|
|
%span.member-access-text.user-access-role= member.human_access
|
|
|
|
|
|
|
|
= render_if_exists 'shared/members/ee/override_member_buttons', group: @group, member: member, user: user, action: :confirm, can_override: member.can_override?
|