Commit ff7766b9 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'project-members-scb' into 'master'

Resolve CE/EE diffs in project members

Closes gitlab-ee#10496

See merge request gitlab-org/gitlab-ce!28550
parents e2126185 55cccf21
...@@ -319,6 +319,30 @@ module ProjectsHelper ...@@ -319,6 +319,30 @@ module ProjectsHelper
Ability.allowed?(current_user, :admin_project_member, @project) Ability.allowed?(current_user, :admin_project_member, @project)
end end
def project_can_be_shared?
!membership_locked? || @project.allowed_to_share_with_group?
end
def membership_locked?
false
end
def share_project_description(project)
share_with_group = project.allowed_to_share_with_group?
share_with_members = !membership_locked?
description =
if share_with_group && share_with_members
_("You can invite a new member to <strong>%{project_name}</strong> or invite another group.")
elsif share_with_group
_("You can invite another group to <strong>%{project_name}</strong>.")
elsif share_with_members
_("You can invite a new member to <strong>%{project_name}</strong>.")
end
description.html_safe % { project_name: project.name }
end
private private
def get_project_nav_tabs(project, current_user) def get_project_nav_tabs(project, current_user)
......
- page_title _("Members") - page_title _("Members")
- can_admin_project_members = can?(current_user, :admin_project_member, @project)
.row.prepend-top-default .row.prepend-top-default
.col-lg-12 .col-lg-12
%h4 - if project_can_be_shared?
= _("Project members") %h4
- if can?(current_user, :admin_project_member, @project) = _("Project members")
%p - if can_admin_project_members
= _("You can invite a new member to <strong>%{project_name}</strong> or invite another group.").html_safe % { project_name: sanitize(@project.name, tags: []) } %p= share_project_description(@project)
- else - else
%p %p
= _("Members can be added by project <i>Maintainers</i> or <i>Owners</i>").html_safe = _("Members can be added by project <i>Maintainers</i> or <i>Owners</i>").html_safe
.light .light
- if can?(current_user, :admin_project_member, @project) - if can_admin_project_members && project_can_be_shared?
%ul.nav-links.nav.nav-tabs.gitlab-tabs{ role: 'tablist' } - if !membership_locked? && @project.allowed_to_share_with_group?
%li.nav-tab{ role: 'presentation' } %ul.nav-links.nav.nav-tabs.gitlab-tabs{ role: 'tablist' }
%a.nav-link.active{ href: '#invite-member-pane', id: 'invite-member-tab', data: { toggle: 'tab' }, role: 'tab' }= _("Invite member")
- if @project.allowed_to_share_with_group?
%li.nav-tab{ role: 'presentation' } %li.nav-tab{ role: 'presentation' }
%a.nav-link.active{ href: '#invite-member-pane', id: 'invite-member-tab', data: { toggle: 'tab' }, role: 'tab' }= _("Invite member")
%li.nav-tab{ role: 'presentation', class: ('active' if membership_locked?) }
%a.nav-link{ href: '#invite-group-pane', id: 'invite-group-tab', data: { toggle: 'tab' }, role: 'tab' }= _("Invite group") %a.nav-link{ href: '#invite-group-pane', id: 'invite-group-tab', data: { toggle: 'tab' }, role: 'tab' }= _("Invite group")
.tab-content.gitlab-tab-content .tab-content.gitlab-tab-content
.tab-pane.active{ id: 'invite-member-pane', role: 'tabpanel' } .tab-pane.active{ id: 'invite-member-pane', role: 'tabpanel' }
= render 'projects/project_members/new_project_member', tab_title: _('Invite member') = render 'projects/project_members/new_project_member', tab_title: _('Invite member')
.tab-pane{ id: 'invite-group-pane', role: 'tabpanel' } .tab-pane{ id: 'invite-group-pane', role: 'tabpanel', class: ('active' if membership_locked?) }
= render 'projects/project_members/new_project_group', tab_title: _('Invite group') = render 'projects/project_members/new_project_group', tab_title: _('Invite group')
- elsif !membership_locked?
.invite-member= render 'projects/project_members/new_project_member', tab_title: _('Invite member')
- elsif @project.allowed_to_share_with_group?
.invite-group= render 'projects/project_members/new_project_group', tab_title: _('Invite group')
= render 'shared/members/requests', membership_source: @project, requesters: @requesters = render 'shared/members/requests', membership_source: @project, requesters: @requesters
.clearfix .clearfix
......
...@@ -11286,6 +11286,12 @@ msgstr "" ...@@ -11286,6 +11286,12 @@ msgstr ""
msgid "You can invite a new member to <strong>%{project_name}</strong> or invite another group." msgid "You can invite a new member to <strong>%{project_name}</strong> or invite another group."
msgstr "" msgstr ""
msgid "You can invite a new member to <strong>%{project_name}</strong>."
msgstr ""
msgid "You can invite another group to <strong>%{project_name}</strong>."
msgstr ""
msgid "You can move around the graph by using the arrow keys." msgid "You can move around the graph by using the arrow keys."
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment