2017-08-17 22:00:37 +05:30
|
|
|
- model_name = source.model_name.to_s.downcase
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
- if can?(current_user, :"destroy_#{model_name}_member", source.members.find_by(user_id: current_user.id)) # rubocop: disable CodeReuse/ActiveRecord
|
2017-09-10 17:25:29 +05:30
|
|
|
.project-action-button.inline
|
|
|
|
- link_text = source.is_a?(Group) ? _('Leave group') : _('Leave project')
|
|
|
|
= link_to link_text, polymorphic_path([:leave, source, :members]),
|
2017-08-17 22:00:37 +05:30
|
|
|
method: :delete,
|
|
|
|
data: { confirm: leave_confirmation_message(source) },
|
|
|
|
class: 'btn'
|
2018-12-05 23:21:45 +05:30
|
|
|
- elsif requester = source.requesters.find_by(user_id: current_user.id) # rubocop: disable CodeReuse/ActiveRecord
|
2017-09-10 17:25:29 +05:30
|
|
|
.project-action-button.inline
|
|
|
|
= link_to _('Withdraw Access Request'), polymorphic_path([:leave, source, :members]),
|
2016-08-24 12:49:21 +05:30
|
|
|
method: :delete,
|
|
|
|
data: { confirm: remove_member_message(requester) },
|
|
|
|
class: 'btn'
|
2017-09-10 17:25:29 +05:30
|
|
|
- elsif source.request_access_enabled && can?(current_user, :request_access, source)
|
|
|
|
.project-action-button.inline
|
|
|
|
= link_to _('Request Access'), polymorphic_path([:request_access, source, :members]),
|
2016-06-22 15:30:34 +05:30
|
|
|
method: :post,
|
2016-08-24 12:49:21 +05:30
|
|
|
class: 'btn'
|