BigW Consortium Gitlab

Commit 03369a91 by Dmitriy Zaporozhets

Use one helper for linking to team member. More clear title for Issue and MR

parent 57e210f6
......@@ -426,25 +426,21 @@ p.time {
}
.status_info {
font-size: 14px;
font-size: 18px;
padding: 5px 15px;
line-height: 24px;
width: 60px;
line-height: 48px;
text-align: center;
float: left;
margin-right: 20px;
float: right;
position: relative;
top: -15px;
left: 15px;
background: #F5F5F5;
&.success {
background: #5BB75B;
color: white;
text-shadow: 0 1px #111;
border-color: #9A9;
}
&.error {
background: #DA4E49;
border-color: #BD362F;
color: white;
text-shadow: 0 1px #111;
color: #C32;
border-bottom: 5px solid #C32;
}
}
......
......@@ -41,6 +41,15 @@
}
}
.top_box_content {
.box-title {
color: $style_color;
font-size: 18px;
font-weight: normal;
line-height: 28px;
}
}
.middle_box_content {
@include border-radius(0);
border: none;
......
......@@ -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
......
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
......
......@@ -26,22 +26,16 @@
.main_box
.top_box_content
%h4
%h4.box-title
- if @issue.closed
.alert-message.error.status_info Closed
- else
.alert-message.success.status_info Open
.error.status_info Closed
= gfm escape_once(@issue.title)
.middle_box_content
%cite.cgray Created by
= image_tag gravatar_icon(@issue.author_email), width: 16, class: "lil_av"
%strong.author= link_to_issue_author(@issue)
- if @issue.assignee
%cite.cgray and currently assigned to
= image_tag gravatar_icon(@issue.assignee_email), width: 16, class: "lil_av"
%strong.author= link_to_issue_assignee(@issue)
%cite.cgray
Created by #{link_to_member(@project, @issue.author)}
- if @issue.assignee
\ and currently assigned to #{link_to_member(@project, @issue.assignee)}
- if @issue.milestone
- milestone = @issue.milestone
......
.main_box
.top_box_content
%h4
%h4.box-title
- if @merge_request.closed
.alert-message.error.status_info Closed
- else
.alert-message.success.status_info Open
.error.status_info Closed
= gfm escape_once(@merge_request.title)
.middle_box_content
%div
%cite.cgray Created at #{@merge_request.created_at.stamp("Aug 21, 2011")} by
= image_tag gravatar_icon(@merge_request.author_email), width: 16, class: "lil_av"
%strong.author= link_to_merge_request_author(@merge_request)
- if @merge_request.assignee
%cite.cgray , currently assigned to
= image_tag gravatar_icon(@merge_request.assignee_email), width: 16, class: "lil_av"
%strong.author= link_to_merge_request_assignee(@merge_request)
%cite.cgray
Created at #{@merge_request.created_at.stamp("Aug 21, 2011")} by #{link_to_member(@project, @merge_request.author)}
- if @merge_request.assignee
\, currently assigned to #{link_to_member(@project, @merge_request.assignee)}
- if @merge_request.milestone
- milestone = @merge_request.milestone
%cite.cgray and attached to milestone
......@@ -27,10 +21,10 @@
.bottom_box_content
- if @merge_request.merged?
%span
Merged by #{@merge_request.merge_event.author_name}
Merged by #{link_to_member(@project, @merge_request.merge_event.author)}
%small #{time_ago_in_words(@merge_request.merge_event.created_at)} ago.
- elsif @merge_request.closed_event
%span
Closed by #{@merge_request.closed_event.author_name}
Closed by #{link_to_member(@project, @merge_request.closed_event.author)}
%small #{time_ago_in_words(@merge_request.closed_event.created_at)} ago.
......@@ -7,7 +7,7 @@
%span.right
- if @merge_request.merged?
%span.btn.small.disabled.grouped
%span.btn.small.disabled.grouped.success
%strong
%i.icon-ok
= "MERGED"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment