Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
a334f0641ce3
Unverified
Commit
49e32cb5
authored
Nov 17, 2015
by
Dmitriy Zaporozhets
Browse files
Remove small code duplication in user_reference_filter.rb
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
3eae42f7cc69
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/gitlab/markdown/user_reference_filter.rb
View file @
a334f064
...
...
@@ -85,13 +85,12 @@ def link_class
def
link_to_all
project
=
context
[
:project
]
url
=
urls
.
namespace_project_url
(
project
.
namespace
,
project
,
only_path:
context
[
:only_path
])
data
=
data_attribute
(
project:
project
.
id
)
text
=
User
.
reference_prefix
+
'all'
%(<a href="#{url}" #{data} class="#{link_class}">#{text}</a>)
link_tag
(
url
,
data
,
text
)
end
def
link_to_namespace
(
namespace
)
...
...
@@ -105,16 +104,20 @@ def link_to_namespace(namespace)
def
link_to_group
(
group
,
namespace
)
url
=
urls
.
group_url
(
group
,
only_path:
context
[
:only_path
])
data
=
data_attribute
(
group:
namespace
.
id
)
text
=
Group
.
reference_prefix
+
group
%(<a href="#{url}" #{data} class="#{link_class}">#{text}</a>)
link_tag
(
url
,
data
,
text
)
end
def
link_to_user
(
user
,
namespace
)
url
=
urls
.
user_url
(
user
,
only_path:
context
[
:only_path
])
data
=
data_attribute
(
user:
namespace
.
owner_id
)
text
=
User
.
reference_prefix
+
user
link_tag
(
url
,
data
,
text
)
end
def
link_tag
(
url
,
data
,
text
)
%(<a href="#{url}" #{data} class="#{link_class}">#{text}</a>)
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