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

This commit is contained in:
Dmitriy Zaporozhets 2012-12-13 06:14:05 +03:00
parent 57e210f6e5
commit 03369a9165
8 changed files with 55 additions and 84 deletions

View file

@ -426,25 +426,21 @@ p.time {
} }
.status_info { .status_info {
font-size: 14px; font-size: 18px;
padding: 5px 15px; padding: 5px 15px;
line-height: 24px; line-height: 48px;
width: 60px;
text-align: center; text-align: center;
float: left; float: right;
margin-right: 20px; position: relative;
top: -15px;
left: 15px;
background: #F5F5F5;
&.success { &.success {
background: #5BB75B;
color: white;
text-shadow: 0 1px #111;
border-color: #9A9;
} }
&.error { &.error {
background: #DA4E49; color: #C32;
border-color: #BD362F; border-bottom: 5px solid #C32;
color: white;
text-shadow: 0 1px #111;
} }
} }

View file

@ -41,6 +41,15 @@
} }
} }
.top_box_content {
.box-title {
color: $style_color;
font-size: 18px;
font-weight: normal;
line-height: 28px;
}
}
.middle_box_content { .middle_box_content {
@include border-radius(0); @include border-radius(0);
border: none; border: none;

View file

@ -4,28 +4,6 @@ module IssuesHelper
project_issues_path project, params project_issues_path project, params
end 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 def issue_css_classes issue
classes = "issue" classes = "issue"
classes << " closed" if issue.closed classes << " closed" if issue.closed

View file

@ -1,26 +1,4 @@
module MergeRequestsHelper 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) def new_mr_path_from_push_event(event)
new_project_merge_request_path( new_project_merge_request_path(
event.project, event.project,

View file

@ -20,6 +20,28 @@ module ProjectsHelper
end end
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 def tm_path team_member
project_team_member_path(@project, team_member) project_team_member_path(@project, team_member)
end end

View file

@ -26,22 +26,16 @@
.main_box .main_box
.top_box_content .top_box_content
%h4 %h4.box-title
- if @issue.closed - if @issue.closed
.alert-message.error.status_info Closed .error.status_info Closed
- else
.alert-message.success.status_info Open
= gfm escape_once(@issue.title) = gfm escape_once(@issue.title)
.middle_box_content .middle_box_content
%cite.cgray Created by %cite.cgray
= image_tag gravatar_icon(@issue.author_email), width: 16, class: "lil_av" Created by #{link_to_member(@project, @issue.author)}
%strong.author= link_to_issue_author(@issue) - if @issue.assignee
\ and currently assigned to #{link_to_member(@project, @issue.assignee)}
- 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)
- if @issue.milestone - if @issue.milestone
- milestone = @issue.milestone - milestone = @issue.milestone

View file

@ -1,22 +1,16 @@
.main_box .main_box
.top_box_content .top_box_content
%h4 %h4.box-title
- if @merge_request.closed - if @merge_request.closed
.alert-message.error.status_info Closed .error.status_info Closed
- else
.alert-message.success.status_info Open
= gfm escape_once(@merge_request.title) = gfm escape_once(@merge_request.title)
.middle_box_content .middle_box_content
%div %div
%cite.cgray Created at #{@merge_request.created_at.stamp("Aug 21, 2011")} by %cite.cgray
= image_tag gravatar_icon(@merge_request.author_email), width: 16, class: "lil_av" Created at #{@merge_request.created_at.stamp("Aug 21, 2011")} by #{link_to_member(@project, @merge_request.author)}
%strong.author= link_to_merge_request_author(@merge_request) - if @merge_request.assignee
\, currently assigned to #{link_to_member(@project, @merge_request.assignee)}
- 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)
- if @merge_request.milestone - if @merge_request.milestone
- milestone = @merge_request.milestone - milestone = @merge_request.milestone
%cite.cgray and attached to milestone %cite.cgray and attached to milestone
@ -27,10 +21,10 @@
.bottom_box_content .bottom_box_content
- if @merge_request.merged? - if @merge_request.merged?
%span %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. %small #{time_ago_in_words(@merge_request.merge_event.created_at)} ago.
- elsif @merge_request.closed_event - elsif @merge_request.closed_event
%span %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. %small #{time_ago_in_words(@merge_request.closed_event.created_at)} ago.

View file

@ -7,7 +7,7 @@
%span.right %span.right
- if @merge_request.merged? - if @merge_request.merged?
%span.btn.small.disabled.grouped %span.btn.small.disabled.grouped.success
%strong %strong
%i.icon-ok %i.icon-ok
= "MERGED" = "MERGED"