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
a96c2de1
Commit
a96c2de1
authored
Jan 31, 2022
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an array to compile a string of CSS classes
parent
2bd808a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+14
-6
No files found.
app/helpers/projects_helper.rb
View file @
a96c2de1
...
...
@@ -62,23 +62,31 @@ module ProjectsHelper
name:
author
.
name
}
author_html
=
[]
inject_classes
=
[
"author-link"
]
if
opts
[
:name
]
inject_classes
.
append
(
"js-user-link"
)
inject_classes
.
append
(
opts
[
:extra_class
]
)
inject_classes
.
append
(
opts
[
:mobile_classes
]
)
else
inject_classes
.
append
(
"has-tooltip"
)
end
inject_classes
=
inject_classes
.
compact
.
join
(
" "
)
author_html
=
[]
# Build avatar image tag
author_html
<<
link_to_member_avatar
(
author
,
opts
)
if
opts
[
:avatar
]
# Build name span tag
author_html
<<
author_content_tag
(
author
,
opts
)
if
opts
[
:name
]
author_html
<<
capture
(
&
block
)
if
block
author_html
=
author_html
.
join
.
html_safe
if
opts
[
:name
]
link_to
(
author_html
,
user_path
(
author
),
class:
"author-link js-user-link
#{
"
#{
opts
[
:extra_class
]
}
"
if
opts
[
:extra_class
]
}
#{
"
#{
opts
[
:mobile_classes
]
}
"
if
opts
[
:mobile_classes
]
}
"
,
data:
data_attrs
).
html_safe
link_to
(
author_html
,
user_path
(
author
),
class:
inject_classes
,
data:
data_attrs
).
html_safe
else
title
=
opts
[
:title
].
sub
(
":name"
,
sanitize
(
author
.
name
))
link_to
(
author_html
,
user_path
(
author
),
class:
"author-link has-tooltip"
,
title:
title
,
data:
{
container:
'body'
,
qa_selector:
'assignee_link'
}).
html_safe
link_to
(
author_html
,
user_path
(
author
),
class:
inject_classes
,
title:
title
,
data:
{
container:
'body'
,
qa_selector:
'assignee_link'
}).
html_safe
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