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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ded9a9d5
Commit
ded9a9d5
authored
Jun 07, 2021
by
Jonas Waelter
Committed by
Natalia Tepluhina
Jun 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add link to admin area on project view and group view
Changelog: added
parent
91b6724f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
0 deletions
+72
-0
app/views/groups/_home_panel.html.haml
app/views/groups/_home_panel.html.haml
+4
-0
app/views/projects/_home_panel.html.haml
app/views/projects/_home_panel.html.haml
+4
-0
locale/gitlab.pot
locale/gitlab.pot
+6
-0
spec/views/groups/_home_panel.html.haml_spec.rb
spec/views/groups/_home_panel.html.haml_spec.rb
+26
-0
spec/views/projects/_home_panel.html.haml_spec.rb
spec/views/projects/_home_panel.html.haml_spec.rb
+32
-0
No files found.
app/views/groups/_home_panel.html.haml
View file @
ded9a9d5
...
...
@@ -23,6 +23,10 @@
.home-panel-buttons.col-md-12.col-lg-6
-
if
current_user
.gl-display-flex.gl-flex-wrap.gl-lg-justify-content-end.gl-mx-n2
{
data:
{
testid:
'group-buttons'
}
}
-
if
current_user
.
admin?
=
link_to
[
:admin
,
@group
],
class:
'btn btn-default gl-button btn-icon gl-mt-3 gl-mr-2'
,
title:
s_
(
'View group in admin area'
),
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
sprite_icon
(
'admin'
)
-
if
@notification_setting
.js-vue-notification-dropdown
{
data:
{
disabled:
emails_disabled
.
to_s
,
dropdown_items:
notification_dropdown_items
(
@notification_setting
).
to_json
,
notification_level:
@notification_setting
.
level
,
help_page_path:
help_page_path
(
'user/profile/notifications'
),
group_id:
@group
.
id
,
container_class:
'gl-mx-2 gl-mt-3 gl-vertical-align-top'
}
}
-
if
can_create_subgroups
...
...
app/views/projects/_home_panel.html.haml
View file @
ded9a9d5
...
...
@@ -47,6 +47,10 @@
=
cache_if
(
cache_enabled
,
[
@project
,
:buttons
,
current_user
,
@notification_setting
],
expires_in:
1
.
day
)
do
.project-repo-buttons.gl-display-flex.gl-justify-content-md-end.gl-align-items-start.gl-flex-wrap.gl-mt-5
-
if
current_user
-
if
current_user
.
admin?
=
link_to
[
:admin
,
@project
],
class:
'btn gl-button btn-icon gl-align-self-start gl-py-2! gl-mr-3'
,
title:
s_
(
'View project in admin area'
),
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
sprite_icon
(
'admin'
)
.gl-display-flex.gl-align-items-start.gl-mr-3
-
if
@notification_setting
.js-vue-notification-dropdown
{
data:
{
button_size:
"small"
,
disabled:
emails_disabled
.
to_s
,
dropdown_items:
notification_dropdown_items
(
@notification_setting
).
to_json
,
notification_level:
@notification_setting
.
level
,
help_page_path:
help_page_path
(
'user/profile/notifications'
),
project_id:
@project
.
id
}
}
...
...
locale/gitlab.pot
View file @
ded9a9d5
...
...
@@ -35845,6 +35845,9 @@ msgstr ""
msgid "View full log"
msgstr ""
msgid "View group in admin area"
msgstr ""
msgid "View group labels"
msgstr ""
...
...
@@ -35896,6 +35899,9 @@ msgstr ""
msgid "View project"
msgstr ""
msgid "View project in admin area"
msgstr ""
msgid "View project labels"
msgstr ""
...
...
spec/views/groups/_home_panel.html.haml_spec.rb
View file @
ded9a9d5
...
...
@@ -14,4 +14,30 @@ RSpec.describe 'groups/_home_panel' do
expect
(
rendered
).
to
have_content
(
"Group ID:
#{
group
.
id
}
"
)
end
context
'admin area link'
do
it
'renders admin area link for admin'
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
create
(
:admin
))
render
expect
(
rendered
).
to
have_link
(
href:
admin_group_path
(
group
))
end
it
'does not render admin area link for non-admin'
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
create
(
:user
))
render
expect
(
rendered
).
not_to
have_link
(
href:
admin_group_path
(
group
))
end
it
'does not render admin area link for anonymous'
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
nil
)
render
expect
(
rendered
).
not_to
have_link
(
href:
admin_group_path
(
group
))
end
end
end
spec/views/projects/_home_panel.html.haml_spec.rb
View file @
ded9a9d5
...
...
@@ -5,6 +5,38 @@ require 'spec_helper'
RSpec
.
describe
'projects/_home_panel'
do
include
ProjectForksHelper
context
'admin area link'
do
let
(
:project
)
{
create
(
:project
)
}
before
do
assign
(
:project
,
project
)
end
it
'renders admin area link for admin'
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
create
(
:admin
))
render
expect
(
rendered
).
to
have_link
(
href:
admin_project_path
(
project
))
end
it
'does not render admin area link for non-admin'
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
create
(
:user
))
render
expect
(
rendered
).
not_to
have_link
(
href:
admin_project_path
(
project
))
end
it
'does not render admin area link for anonymous'
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
nil
)
render
expect
(
rendered
).
not_to
have_link
(
href:
admin_project_path
(
project
))
end
end
context
'notifications'
do
let
(
:project
)
{
create
(
:project
)
}
...
...
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