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
ecd0c175
Commit
ecd0c175
authored
Dec 16, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dz-nested-groups-title-ui' into 'master'
UI improvements for nested group feature See merge request !8062
parents
49a70d1e
82f9957d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
8 deletions
+50
-8
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+9
-2
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+2
-2
app/models/group.rb
app/models/group.rb
+1
-1
app/models/namespace.rb
app/models/namespace.rb
+13
-0
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
+1
-1
app/views/shared/groups/_group.html.haml
app/views/shared/groups/_group.html.haml
+1
-1
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+22
-0
No files found.
app/helpers/groups_helper.rb
View file @
ecd0c175
...
@@ -12,11 +12,18 @@ module GroupsHelper
...
@@ -12,11 +12,18 @@ module GroupsHelper
end
end
def
group_title
(
group
,
name
=
nil
,
url
=
nil
)
def
group_title
(
group
,
name
=
nil
,
url
=
nil
)
full_title
=
link_to
(
simple_sanitize
(
group
.
name
),
group_path
(
group
))
full_title
=
''
group
.
parents
.
each
do
|
parent
|
full_title
+=
link_to
(
simple_sanitize
(
parent
.
name
),
group_path
(
parent
))
full_title
+=
' / '
.
html_safe
end
full_title
+=
link_to
(
simple_sanitize
(
group
.
name
),
group_path
(
group
))
full_title
+=
' · '
.
html_safe
+
link_to
(
simple_sanitize
(
name
),
url
)
if
name
full_title
+=
' · '
.
html_safe
+
link_to
(
simple_sanitize
(
name
),
url
)
if
name
content_tag
:span
do
content_tag
:span
do
full_title
full_title
.
html_safe
end
end
end
end
...
...
app/helpers/projects_helper.rb
View file @
ecd0c175
...
@@ -52,7 +52,7 @@ module ProjectsHelper
...
@@ -52,7 +52,7 @@ module ProjectsHelper
def
project_title
(
project
)
def
project_title
(
project
)
namespace_link
=
namespace_link
=
if
project
.
group
if
project
.
group
link_to
(
simple_sanitize
(
project
.
group
.
name
),
group_path
(
project
.
group
)
)
group_title
(
project
.
group
)
else
else
owner
=
project
.
namespace
.
owner
owner
=
project
.
namespace
.
owner
link_to
(
simple_sanitize
(
owner
.
name
),
user_path
(
owner
))
link_to
(
simple_sanitize
(
owner
.
name
),
user_path
(
owner
))
...
@@ -390,7 +390,7 @@ module ProjectsHelper
...
@@ -390,7 +390,7 @@ module ProjectsHelper
"success"
"success"
end
end
end
end
def
readme_cache_key
def
readme_cache_key
sha
=
@project
.
commit
.
try
(
:sha
)
||
'nil'
sha
=
@project
.
commit
.
try
(
:sha
)
||
'nil'
[
@project
.
path_with_namespace
,
sha
,
"readme"
].
join
(
'-'
)
[
@project
.
path_with_namespace
,
sha
,
"readme"
].
join
(
'-'
)
...
...
app/models/group.rb
View file @
ecd0c175
...
@@ -83,7 +83,7 @@ class Group < Namespace
...
@@ -83,7 +83,7 @@ class Group < Namespace
end
end
def
human_name
def
human_name
name
full_
name
end
end
def
visibility_level_field
def
visibility_level_field
...
...
app/models/namespace.rb
View file @
ecd0c175
...
@@ -161,6 +161,19 @@ class Namespace < ActiveRecord::Base
...
@@ -161,6 +161,19 @@ class Namespace < ActiveRecord::Base
end
end
end
end
def
full_name
@full_name
||=
if
parent
parent
.
full_name
+
' / '
+
name
else
name
end
end
def
parents
@parents
||=
parent
?
parent
.
parents
+
[
parent
]
:
[]
end
private
private
def
repository_storage_paths
def
repository_storage_paths
...
...
app/views/admin/groups/_group.html.haml
View file @
ecd0c175
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
=
image_tag
group_icon
(
group
),
class:
"avatar s40 hidden-xs"
=
image_tag
group_icon
(
group
),
class:
"avatar s40 hidden-xs"
.title
.title
=
link_to
[
:admin
,
group
],
class:
'group-name'
do
=
link_to
[
:admin
,
group
],
class:
'group-name'
do
=
group
.
name
=
group
.
full_
name
-
if
group
.
description
.
present?
-
if
group
.
description
.
present?
.description
.description
...
...
app/views/admin/groups/show.html.haml
View file @
ecd0c175
-
page_title
@group
.
name
,
"Groups"
-
page_title
@group
.
name
,
"Groups"
%h3
.page-title
%h3
.page-title
Group:
#{
@group
.
name
}
Group:
#{
@group
.
full_
name
}
=
link_to
admin_group_edit_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
...
...
app/views/shared/groups/_group.html.haml
View file @
ecd0c175
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
=
image_tag
group_icon
(
group
),
class:
"avatar s40 hidden-xs"
=
image_tag
group_icon
(
group
),
class:
"avatar s40 hidden-xs"
.title
.title
=
link_to
group
,
class:
'group-name'
do
=
link_to
group
,
class:
'group-name'
do
=
group
.
name
=
group
.
full_
name
-
if
group_member
-
if
group_member
as
as
...
...
spec/models/namespace_spec.rb
View file @
ecd0c175
...
@@ -128,4 +128,26 @@ describe Namespace, models: true do
...
@@ -128,4 +128,26 @@ describe Namespace, models: true do
it
{
expect
(
group
.
full_path
).
to
eq
(
group
.
path
)
}
it
{
expect
(
group
.
full_path
).
to
eq
(
group
.
path
)
}
it
{
expect
(
nested_group
.
full_path
).
to
eq
(
"
#{
group
.
path
}
/
#{
nested_group
.
path
}
"
)
}
it
{
expect
(
nested_group
.
full_path
).
to
eq
(
"
#{
group
.
path
}
/
#{
nested_group
.
path
}
"
)
}
end
end
describe
'#full_name'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
it
{
expect
(
group
.
full_name
).
to
eq
(
group
.
name
)
}
it
{
expect
(
nested_group
.
full_name
).
to
eq
(
"
#{
group
.
name
}
/
#{
nested_group
.
name
}
"
)
}
end
describe
'#parents'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
let
(
:deep_nested_group
)
{
create
(
:group
,
parent:
nested_group
)
}
let
(
:very_deep_nested_group
)
{
create
(
:group
,
parent:
deep_nested_group
)
}
it
'returns the correct parents'
do
expect
(
very_deep_nested_group
.
parents
).
to
eq
([
group
,
nested_group
,
deep_nested_group
])
expect
(
deep_nested_group
.
parents
).
to
eq
([
group
,
nested_group
])
expect
(
nested_group
.
parents
).
to
eq
([
group
])
expect
(
group
.
parents
).
to
eq
([])
end
end
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