2016-08-11 11:00:31 -04:00
|
|
|
- show_roles = local_assigns.fetch(:show_roles, true)
|
2016-04-18 12:53:32 -04:00
|
|
|
- show_controls = local_assigns.fetch(:show_controls, true)
|
2017-07-05 15:17:02 -04:00
|
|
|
- force_mobile_view = local_assigns.fetch(:force_mobile_view, false)
|
2017-12-05 09:03:16 -05:00
|
|
|
- member = local_assigns.fetch(:member)
|
2016-09-01 11:22:53 -04:00
|
|
|
- user = local_assigns.fetch(:user, member.user)
|
2016-09-02 10:10:22 -04:00
|
|
|
- source = member.source
|
2016-04-18 12:53:32 -04:00
|
|
|
|
2016-08-31 10:28:58 -04:00
|
|
|
%li.member{ class: dom_class(member), id: dom_id(member) }
|
2016-09-12 10:34:54 -04:00
|
|
|
%span.list-item-name
|
2016-07-06 12:34:47 -04:00
|
|
|
- if user
|
2018-02-09 05:43:12 -05:00
|
|
|
= image_tag avatar_icon_for_user(user, 40), class: "avatar s40", alt: ''
|
2017-07-05 15:17:02 -04:00
|
|
|
.user-info
|
|
|
|
= link_to user.name, user_path(user), class: 'member'
|
|
|
|
%span.cgray= user.to_reference
|
2016-07-06 12:34:47 -04:00
|
|
|
|
2017-07-05 15:17:02 -04:00
|
|
|
- if user == current_user
|
|
|
|
%span.label.label-success.prepend-left-5 It's you
|
2016-07-06 12:34:47 -04:00
|
|
|
|
2017-07-05 15:17:02 -04:00
|
|
|
- if user.blocked?
|
|
|
|
%label.label.label-danger
|
|
|
|
%strong Blocked
|
2016-07-06 12:34:47 -04:00
|
|
|
|
2017-07-05 15:17:02 -04:00
|
|
|
- if source.instance_of?(Group) && source != @group
|
|
|
|
·
|
|
|
|
= link_to source.full_name, source, class: "member-group-link"
|
2016-09-01 11:22:53 -04:00
|
|
|
|
2017-07-05 15:17:02 -04:00
|
|
|
.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-07-06 12:34:47 -04:00
|
|
|
|
|
|
|
- else
|
2018-02-09 06:10:53 -05:00
|
|
|
= image_tag avatar_icon_for_email(member.invite_email, 40), class: "avatar s40", alt: ''
|
2017-07-05 15:17:02 -04:00
|
|
|
.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-09-01 08:48:20 -04:00
|
|
|
- if show_roles
|
2017-02-08 10:02:25 -05:00
|
|
|
- current_resource = @project || @group
|
2016-09-01 08:48:20 -04:00
|
|
|
.controls.member-controls
|
2017-02-08 10:02:25 -05:00
|
|
|
- if show_controls && member.source == current_resource
|
2017-07-05 15:17:02 -04:00
|
|
|
|
2017-12-05 09:03:16 -05:00
|
|
|
- if member.can_resend_invite?
|
2017-07-05 15:17:02 -04:00
|
|
|
= 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-12-05 09:03:16 -05:00
|
|
|
- if user != current_user && member.can_update?
|
2016-09-01 11:22:53 -04:00
|
|
|
= form_for member, remote: true, html: { class: 'form-horizontal js-edit-member-form' } do |f|
|
2016-12-07 10:27:14 -05:00
|
|
|
= 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-align-right.dropdown-menu-selectable
|
|
|
|
= dropdown_title("Change permissions")
|
|
|
|
.dropdown-content
|
|
|
|
%ul
|
2017-12-05 09:03:16 -05:00
|
|
|
- member.access_level_roles.each do |role, role_id|
|
2016-12-07 10:27:14 -05:00
|
|
|
%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-09-02 04:25:53 -04:00
|
|
|
.prepend-left-5.clearable-input.member-form-control
|
2017-12-05 09:03:16 -05:00
|
|
|
= 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) }
|
2016-09-01 11:22:53 -04:00
|
|
|
%i.clear-icon.js-clear-input
|
|
|
|
- else
|
|
|
|
%span.member-access-text= member.human_access
|
2016-10-06 10:41:00 -04:00
|
|
|
|
2017-12-05 09:03:16 -05:00
|
|
|
- if member.can_approve?
|
2017-07-05 15:17:02 -04:00
|
|
|
= link_to polymorphic_path([:approve_access_request, member]),
|
2016-09-01 08:48:20 -04:00
|
|
|
method: :post,
|
2016-09-02 04:25:53 -04:00
|
|
|
class: 'btn btn-success prepend-left-10',
|
2017-07-05 15:17:02 -04:00
|
|
|
title: 'Grant access' do
|
2017-07-07 13:17:03 -04:00
|
|
|
%span{ class: ('visible-xs-block' unless force_mobile_view) }
|
2017-07-05 15:17:02 -04:00
|
|
|
Grant access
|
2017-07-07 13:17:03 -04:00
|
|
|
- unless force_mobile_view
|
2017-07-05 15:17:02 -04:00
|
|
|
= icon('check inverse', class: 'hidden-xs')
|
2016-09-01 08:48:20 -04:00
|
|
|
|
2017-12-05 09:03:16 -05:00
|
|
|
- if member.can_remove?
|
2016-09-01 08:48:20 -04:00
|
|
|
- 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) },
|
2016-09-02 04:25:53 -04:00
|
|
|
class: 'btn btn-remove prepend-left-10'
|
2016-09-01 08:48:20 -04:00
|
|
|
- else
|
2016-09-01 11:22:53 -04:00
|
|
|
= link_to member,
|
2016-09-01 08:48:20 -04:00
|
|
|
method: :delete,
|
|
|
|
data: { confirm: remove_member_message(member) },
|
2016-09-02 04:25:53 -04:00
|
|
|
class: 'btn btn-remove prepend-left-10',
|
2016-09-01 11:22:53 -04:00
|
|
|
title: remove_member_title(member) do
|
2017-07-07 13:17:03 -04:00
|
|
|
%span{ class: ('visible-xs-block' unless force_mobile_view) }
|
2016-09-01 11:22:53 -04:00
|
|
|
Delete
|
2017-07-07 13:17:03 -04:00
|
|
|
- unless force_mobile_view
|
2017-07-05 15:17:02 -04:00
|
|
|
= icon('trash', class: 'hidden-xs')
|
2016-09-02 08:35:43 -04:00
|
|
|
- else
|
|
|
|
%span.member-access-text= member.human_access
|