Commit a7b6430b authored by Tetiana Chupryna's avatar Tetiana Chupryna

Merge branch...

Merge branch '333439-take-a-more-declarative-path-when-using-membership_actions-concern' into 'master'

Take a more declarative path when using membership_actions concern

See merge request gitlab-org/gitlab!63911
parents b6d04632 0c8a27f8
...@@ -140,39 +140,15 @@ module MembershipActions ...@@ -140,39 +140,15 @@ module MembershipActions
end end
def root_params_key def root_params_key
case membershipable raise NotImplementedError
when Namespace
:group_member
when Project
:project_member
else
raise "Unknown membershipable type: #{membershipable}!"
end
end end
def members_page_url def members_page_url
case membershipable raise NotImplementedError
when Namespace
polymorphic_url([membershipable, :members])
when Project
project_project_members_path(membershipable)
else
raise "Unknown membershipable type: #{membershipable}!"
end
end end
def source_type def source_type
@source_type ||= raise NotImplementedError
begin
case membershipable
when Namespace
_("group")
when Project
_("project")
else
raise "Unknown membershipable type: #{membershipable}!"
end
end
end end
def plain_source_type def plain_source_type
......
...@@ -82,6 +82,18 @@ class Groups::GroupMembersController < Groups::ApplicationController ...@@ -82,6 +82,18 @@ class Groups::GroupMembersController < Groups::ApplicationController
def plain_source_type def plain_source_type
'group' 'group'
end end
def source_type
_("group")
end
def members_page_url
polymorphic_url([group, :members])
end
def root_params_key
:group_member
end
end end
Groups::GroupMembersController.prepend_mod_with('Groups::GroupMembersController') Groups::GroupMembersController.prepend_mod_with('Groups::GroupMembersController')
...@@ -66,6 +66,18 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -66,6 +66,18 @@ class Projects::ProjectMembersController < Projects::ApplicationController
def plain_source_type def plain_source_type
'project' 'project'
end end
def source_type
_("project")
end
def members_page_url
project_project_members_path(project)
end
def root_params_key
:project_member
end
end end
Projects::ProjectMembersController.prepend_mod_with('Projects::ProjectMembersController') Projects::ProjectMembersController.prepend_mod_with('Projects::ProjectMembersController')
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