Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
d8b7df3c
Commit
d8b7df3c
authored
Dec 08, 2016
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for nested groups to admin routing
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
3f768f9a
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
48 additions
and
27 deletions
+48
-27
app/views/admin/dashboard/_head.html.haml
app/views/admin/dashboard/_head.html.haml
+1
-1
app/views/admin/dashboard/index.html.haml
app/views/admin/dashboard/index.html.haml
+1
-1
app/views/admin/groups/_group.html.haml
app/views/admin/groups/_group.html.haml
+1
-1
app/views/admin/groups/show.html.haml
app/views/admin/groups/show.html.haml
+2
-2
app/views/admin/projects/index.html.haml
app/views/admin/projects/index.html.haml
+6
-6
app/views/repository_check_mailer/notify.html.haml
app/views/repository_check_mailer/notify.html.haml
+1
-1
app/views/repository_check_mailer/notify.text.haml
app/views/repository_check_mailer/notify.text.haml
+1
-1
config/routes/admin.rb
config/routes/admin.rb
+16
-7
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+1
-1
spec/features/admin/admin_groups_spec.rb
spec/features/admin/admin_groups_spec.rb
+1
-1
spec/features/admin/admin_projects_spec.rb
spec/features/admin/admin_projects_spec.rb
+3
-3
spec/features/security/admin_access_spec.rb
spec/features/security/admin_access_spec.rb
+1
-1
spec/routing/admin_routing_spec.rb
spec/routing/admin_routing_spec.rb
+13
-1
No files found.
app/views/admin/dashboard/_head.html.haml
View file @
d8b7df3c
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
%span
%span
Overview
Overview
=
nav_link
(
controller:
[
:admin
,
:projects
])
do
=
nav_link
(
controller:
[
:admin
,
:projects
])
do
=
link_to
admin_
namespaces_
projects_path
,
title:
'Projects'
do
=
link_to
admin_projects_path
,
title:
'Projects'
do
%span
%span
Projects
Projects
=
nav_link
(
controller: :users
)
do
=
nav_link
(
controller: :users
)
do
...
...
app/views/admin/dashboard/index.html.haml
View file @
d8b7df3c
...
@@ -116,7 +116,7 @@
...
@@ -116,7 +116,7 @@
.light-well.well-centered
.light-well.well-centered
%h4
Projects
%h4
Projects
.data
.data
=
link_to
admin_
namespaces_
projects_path
do
=
link_to
admin_projects_path
do
%h1
=
number_with_delimiter
(
Project
.
cached_count
)
%h1
=
number_with_delimiter
(
Project
.
cached_count
)
%hr
%hr
=
link_to
(
'New Project'
,
new_project_path
,
class:
"btn btn-new"
)
=
link_to
(
'New Project'
,
new_project_path
,
class:
"btn btn-new"
)
...
...
app/views/admin/groups/_group.html.haml
View file @
d8b7df3c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
%li
.group-row
{
class:
css_class
}
%li
.group-row
{
class:
css_class
}
.controls
.controls
=
link_to
'Edit'
,
edit_admin_group
_path
(
group
),
id:
"edit_
#{
dom_id
(
group
)
}
"
,
class:
'btn'
=
link_to
'Edit'
,
admin_group_edit
_path
(
group
),
id:
"edit_
#{
dom_id
(
group
)
}
"
,
class:
'btn'
=
link_to
'Delete'
,
[
:admin
,
group
],
data:
{
confirm:
"Are you sure you want to remove
#{
group
.
name
}
?"
},
method: :delete
,
class:
'btn btn-remove'
=
link_to
'Delete'
,
[
:admin
,
group
],
data:
{
confirm:
"Are you sure you want to remove
#{
group
.
name
}
?"
},
method: :delete
,
class:
'btn btn-remove'
.stats
.stats
%span
%span
...
...
app/views/admin/groups/show.html.haml
View file @
d8b7df3c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
%h3
.page-title
%h3
.page-title
Group:
#{
@group
.
name
}
Group:
#{
@group
.
name
}
=
link_to
edit_admin_group
_path
(
@group
),
class:
"btn pull-right"
do
=
link_to
admin_group_edit
_path
(
@group
),
class:
"btn pull-right"
do
%i
.fa.fa-pencil-square-o
%i
.fa.fa-pencil-square-o
Edit
Edit
%hr
%hr
...
@@ -88,7 +88,7 @@
...
@@ -88,7 +88,7 @@
Read more about project permissions
Read more about project permissions
%strong
=
link_to
"here"
,
help_page_path
(
"user/permissions"
),
class:
"vlink"
%strong
=
link_to
"here"
,
help_page_path
(
"user/permissions"
),
class:
"vlink"
=
form_tag
members_update_admin_group
_path
(
@group
),
id:
"new_project_member"
,
class:
"bulk_import"
,
method: :put
do
=
form_tag
admin_group_members_update
_path
(
@group
),
id:
"new_project_member"
,
class:
"bulk_import"
,
method: :put
do
%div
%div
=
users_select_tag
(
:user_ids
,
multiple:
true
,
email_user:
true
,
scope: :all
)
=
users_select_tag
(
:user_ids
,
multiple:
true
,
email_user:
true
,
scope: :all
)
%div
.prepend-top-10
%div
.prepend-top-10
...
...
app/views/admin/projects/index.html.haml
View file @
d8b7df3c
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
%div
{
class:
container_class
}
%div
{
class:
container_class
}
.top-area
.top-area
.prepend-top-default
.prepend-top-default
=
form_tag
admin_
namespaces_
projects_path
,
method: :get
do
|
f
|
=
form_tag
admin_projects_path
,
method: :get
do
|
f
|
.search-holder
.search-holder
.search-field-holder
.search-field-holder
=
search_field_tag
:name
,
params
[
:name
],
class:
"form-control search-text-input js-search-input"
,
id:
"dashboard_search"
,
autofocus:
true
,
spellcheck:
false
,
placeholder:
'Search by name'
=
search_field_tag
:name
,
params
[
:name
],
class:
"form-control search-text-input js-search-input"
,
id:
"dashboard_search"
,
autofocus:
true
,
spellcheck:
false
,
placeholder:
'Search by name'
...
@@ -41,19 +41,19 @@
...
@@ -41,19 +41,19 @@
=
button_tag
"Search"
,
class:
"btn btn-primary btn-search"
=
button_tag
"Search"
,
class:
"btn btn-primary btn-search"
%ul
.nav-links
%ul
.nav-links
-
opts
=
params
[
:visibility_level
].
present?
?
{}
:
{
page:
admin_
namespaces_
projects_path
}
-
opts
=
params
[
:visibility_level
].
present?
?
{}
:
{
page:
admin_projects_path
}
=
nav_link
(
opts
)
do
=
nav_link
(
opts
)
do
=
link_to
admin_
namespaces_
projects_path
do
=
link_to
admin_projects_path
do
All
All
=
nav_link
(
html_options:
{
class:
params
[
:visibility_level
]
==
Gitlab
::
VisibilityLevel
::
PRIVATE
.
to_s
?
'active'
:
''
})
do
=
nav_link
(
html_options:
{
class:
params
[
:visibility_level
]
==
Gitlab
::
VisibilityLevel
::
PRIVATE
.
to_s
?
'active'
:
''
})
do
=
link_to
admin_
namespaces_
projects_path
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
)
do
=
link_to
admin_projects_path
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
)
do
Private
Private
=
nav_link
(
html_options:
{
class:
params
[
:visibility_level
]
==
Gitlab
::
VisibilityLevel
::
INTERNAL
.
to_s
?
'active'
:
''
})
do
=
nav_link
(
html_options:
{
class:
params
[
:visibility_level
]
==
Gitlab
::
VisibilityLevel
::
INTERNAL
.
to_s
?
'active'
:
''
})
do
=
link_to
admin_
namespaces_
projects_path
(
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
do
=
link_to
admin_projects_path
(
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
do
Internal
Internal
=
nav_link
(
html_options:
{
class:
params
[
:visibility_level
]
==
Gitlab
::
VisibilityLevel
::
PUBLIC
.
to_s
?
'active'
:
''
})
do
=
nav_link
(
html_options:
{
class:
params
[
:visibility_level
]
==
Gitlab
::
VisibilityLevel
::
PUBLIC
.
to_s
?
'active'
:
''
})
do
=
link_to
admin_
namespaces_
projects_path
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
do
=
link_to
admin_projects_path
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
do
Public
Public
.nav-controls
.nav-controls
...
...
app/views/repository_check_mailer/notify.html.haml
View file @
d8b7df3c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#{
@message
}
.
#{
@message
}
.
%p
%p
=
link_to
"See the affected projects in the GitLab admin panel"
,
admin_
namespaces_
projects_url
(
last_repository_check_failed:
1
)
=
link_to
"See the affected projects in the GitLab admin panel"
,
admin_projects_url
(
last_repository_check_failed:
1
)
%p
%p
You are receiving this message because you are a GitLab administrator for
#{
Gitlab
.
config
.
gitlab
.
url
}
.
You are receiving this message because you are a GitLab administrator for
#{
Gitlab
.
config
.
gitlab
.
url
}
.
app/views/repository_check_mailer/notify.text.haml
View file @
d8b7df3c
#{
@message
}
.
#{
@message
}
.
\
\
View details:
#{
admin_
namespaces_
projects_url
(
last_repository_check_failed:
1
)
}
View details:
#{
admin_projects_url
(
last_repository_check_failed:
1
)
}
You are receiving this message because you are a GitLab administrator
You are receiving this message because you are a GitLab administrator
for
#{
Gitlab
.
config
.
gitlab
.
url
}
.
for
#{
Gitlab
.
config
.
gitlab
.
url
}
.
config/routes/admin.rb
View file @
d8b7df3c
...
@@ -28,9 +28,19 @@ namespace :admin do
...
@@ -28,9 +28,19 @@ namespace :admin do
resources
:applications
resources
:applications
resources
:groups
,
constraints:
{
id:
/[^\/]+/
}
do
resources
:groups
,
only:
[
:index
,
:new
,
:create
]
member
do
scope
(
path:
'groups/*id'
,
controller: :groups
,
constraints:
{
id:
Gitlab
::
Regex
.
namespace_route_regex
})
do
scope
(
as: :group
)
do
put
:members_update
put
:members_update
get
:edit
,
action: :edit
get
'/'
,
action: :show
patch
'/'
,
action: :update
put
'/'
,
action: :update
delete
'/'
,
action: :destroy
end
end
end
end
...
@@ -50,14 +60,13 @@ namespace :admin do
...
@@ -50,14 +60,13 @@ namespace :admin do
resource
:system_info
,
controller:
'system_info'
,
only:
[
:show
]
resource
:system_info
,
controller:
'system_info'
,
only:
[
:show
]
resources
:requests_profiles
,
only:
[
:index
,
:show
],
param: :name
,
constraints:
{
name:
/.+\.html/
}
resources
:requests_profiles
,
only:
[
:index
,
:show
],
param: :name
,
constraints:
{
name:
/.+\.html/
}
resources
:namespaces
,
path:
'/projects'
,
constraints:
{
id:
/[a-zA-Z.0-9_\-]+/
},
only:
[]
do
resources
:projects
,
only:
[
:index
]
root
to:
'projects#index'
,
as: :projects
scope
(
path:
'projects/*namespace_id'
,
as: :namespace
)
do
resources
(
:projects
,
resources
(
:projects
,
path:
'/'
,
path:
'/'
,
constraints:
{
id:
/[a-zA-Z.0-9_\-]+/
},
constraints:
{
id:
Gitlab
::
Regex
.
project_route_regex
},
only:
[
:index
,
:show
])
do
only:
[
:show
])
do
root
to:
'projects#show'
member
do
member
do
put
:transfer
put
:transfer
...
...
features/steps/shared/paths.rb
View file @
d8b7df3c
...
@@ -168,7 +168,7 @@ module SharedPaths
...
@@ -168,7 +168,7 @@ module SharedPaths
end
end
step
'I visit admin projects page'
do
step
'I visit admin projects page'
do
visit
admin_
namespaces_
projects_path
visit
admin_projects_path
end
end
step
'I visit admin users page'
do
step
'I visit admin users page'
do
...
...
spec/features/admin/admin_groups_spec.rb
View file @
d8b7df3c
...
@@ -21,7 +21,7 @@ feature 'Admin Groups', feature: true do
...
@@ -21,7 +21,7 @@ feature 'Admin Groups', feature: true do
scenario
'shows the visibility level radio populated with the group visibility_level value'
do
scenario
'shows the visibility level radio populated with the group visibility_level value'
do
group
=
create
(
:group
,
:private
)
group
=
create
(
:group
,
:private
)
visit
edit_admin_group
_path
(
group
)
visit
admin_group_edit
_path
(
group
)
expect_selected_visibility
(
group
.
visibility_level
)
expect_selected_visibility
(
group
.
visibility_level
)
end
end
...
...
spec/features/admin/admin_projects_spec.rb
View file @
d8b7df3c
...
@@ -8,11 +8,11 @@ describe "Admin::Projects", feature: true do
...
@@ -8,11 +8,11 @@ describe "Admin::Projects", feature: true do
describe
"GET /admin/projects"
do
describe
"GET /admin/projects"
do
before
do
before
do
visit
admin_
namespaces_
projects_path
visit
admin_projects_path
end
end
it
"is ok"
do
it
"is ok"
do
expect
(
current_path
).
to
eq
(
admin_
namespaces_
projects_path
)
expect
(
current_path
).
to
eq
(
admin_projects_path
)
end
end
it
"has projects list"
do
it
"has projects list"
do
...
@@ -22,7 +22,7 @@ describe "Admin::Projects", feature: true do
...
@@ -22,7 +22,7 @@ describe "Admin::Projects", feature: true do
describe
"GET /admin/projects/:id"
do
describe
"GET /admin/projects/:id"
do
before
do
before
do
visit
admin_
namespaces_
projects_path
visit
admin_projects_path
click_link
"
#{
@project
.
name
}
"
click_link
"
#{
@project
.
name
}
"
end
end
...
...
spec/features/security/admin_access_spec.rb
View file @
d8b7df3c
...
@@ -4,7 +4,7 @@ describe "Admin::Projects", feature: true do
...
@@ -4,7 +4,7 @@ describe "Admin::Projects", feature: true do
include
AccessMatchers
include
AccessMatchers
describe
"GET /admin/projects"
do
describe
"GET /admin/projects"
do
subject
{
admin_
namespaces_
projects_path
}
subject
{
admin_projects_path
}
it
{
is_expected
.
to
be_allowed_for
:admin
}
it
{
is_expected
.
to
be_allowed_for
:admin
}
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:user
}
...
...
spec/routing/admin_routing_spec.rb
View file @
d8b7df3c
...
@@ -66,7 +66,8 @@ describe Admin::ProjectsController, "routing" do
...
@@ -66,7 +66,8 @@ describe Admin::ProjectsController, "routing" do
end
end
it
"to #show"
do
it
"to #show"
do
expect
(
get
(
"/admin/projects/gitlab"
)).
to
route_to
(
'admin/projects#show'
,
namespace_id:
'gitlab'
)
expect
(
get
(
"/admin/projects/gitlab/gitlab-ce"
)).
to
route_to
(
'admin/projects#show'
,
namespace_id:
'gitlab'
,
id:
'gitlab-ce'
)
expect
(
get
(
"/admin/projects/gitlab/subgroup/gitlab-ce"
)).
to
route_to
(
'admin/projects#show'
,
namespace_id:
'gitlab/subgroup'
,
id:
'gitlab-ce'
)
end
end
end
end
...
@@ -119,3 +120,14 @@ describe Admin::HealthCheckController, "routing" do
...
@@ -119,3 +120,14 @@ describe Admin::HealthCheckController, "routing" do
expect
(
get
(
"/admin/health_check"
)).
to
route_to
(
'admin/health_check#show'
)
expect
(
get
(
"/admin/health_check"
)).
to
route_to
(
'admin/health_check#show'
)
end
end
end
end
describe
Admin
::
GroupsController
,
"routing"
do
it
"to #index"
do
expect
(
get
(
"/admin/groups"
)).
to
route_to
(
'admin/groups#index'
)
end
it
"to #show"
do
expect
(
get
(
"/admin/groups/gitlab"
)).
to
route_to
(
'admin/groups#show'
,
id:
'gitlab'
)
expect
(
get
(
"/admin/groups/gitlab/subgroup"
)).
to
route_to
(
'admin/groups#show'
,
id:
'gitlab/subgroup'
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment