Use one helper for linking to team member. More clear title for Issue and MR
This commit is contained in:
parent
57e210f6e5
commit
03369a9165
8 changed files with 55 additions and 84 deletions
|
@ -4,28 +4,6 @@ module IssuesHelper
|
|||
project_issues_path project, params
|
||||
end
|
||||
|
||||
def link_to_issue_assignee(issue)
|
||||
project = issue.project
|
||||
|
||||
tm = project.team_member_by_id(issue.assignee_id)
|
||||
if tm
|
||||
link_to issue.assignee_name, project_team_member_path(project, tm), class: "author_link"
|
||||
else
|
||||
issue.assignee_name
|
||||
end
|
||||
end
|
||||
|
||||
def link_to_issue_author(issue)
|
||||
project = issue.project
|
||||
|
||||
tm = project.team_member_by_id(issue.author_id)
|
||||
if tm
|
||||
link_to issue.author_name, project_team_member_path(project, tm), class: "author_link"
|
||||
else
|
||||
issue.author_name
|
||||
end
|
||||
end
|
||||
|
||||
def issue_css_classes issue
|
||||
classes = "issue"
|
||||
classes << " closed" if issue.closed
|
||||
|
|
|
@ -1,26 +1,4 @@
|
|||
module MergeRequestsHelper
|
||||
def link_to_merge_request_assignee(merge_request)
|
||||
project = merge_request.project
|
||||
|
||||
tm = project.team_member_by_id(merge_request.assignee_id)
|
||||
if tm
|
||||
link_to merge_request.assignee_name, project_team_member_path(project, tm), class: "author_link"
|
||||
else
|
||||
merge_request.assignee_name
|
||||
end
|
||||
end
|
||||
|
||||
def link_to_merge_request_author(merge_request)
|
||||
project = merge_request.project
|
||||
|
||||
tm = project.team_member_by_id(merge_request.author_id)
|
||||
if tm
|
||||
link_to merge_request.author_name, project_team_member_path(project, tm), class: "author_link"
|
||||
else
|
||||
merge_request.author_name
|
||||
end
|
||||
end
|
||||
|
||||
def new_mr_path_from_push_event(event)
|
||||
new_project_merge_request_path(
|
||||
event.project,
|
||||
|
|
|
@ -20,6 +20,28 @@ module ProjectsHelper
|
|||
end
|
||||
end
|
||||
|
||||
def link_to_member(project, author)
|
||||
return "(deleted)" unless author
|
||||
|
||||
# Build avatar image tag
|
||||
avatar = image_tag(gravatar_icon(author.try(:email)), width: 16, class: "lil_av")
|
||||
|
||||
# Build name strong tag
|
||||
name = content_tag :strong, author.name, class: 'author'
|
||||
|
||||
author_html = avatar + name
|
||||
|
||||
tm = project.team_member_by_id(author)
|
||||
|
||||
content_tag :span, class: 'member-link' do
|
||||
if tm
|
||||
link_to author_html, project_team_member_path(project, tm), class: "author_link"
|
||||
else
|
||||
author_html
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def tm_path team_member
|
||||
project_team_member_path(@project, team_member)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue