From 03369a9165e2f333a3feb501004acf369e339d67 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 13 Dec 2012 06:14:05 +0300 Subject: [PATCH] Use one helper for linking to team member. More clear title for Issue and MR --- app/assets/stylesheets/common.scss | 22 ++++++++----------- .../stylesheets/gitlab_bootstrap/blocks.scss | 9 ++++++++ app/helpers/issues_helper.rb | 22 ------------------- app/helpers/merge_requests_helper.rb | 22 ------------------- app/helpers/projects_helper.rb | 22 +++++++++++++++++++ app/views/issues/show.html.haml | 18 +++++---------- .../merge_requests/show/_mr_box.html.haml | 22 +++++++------------ .../merge_requests/show/_mr_title.html.haml | 2 +- 8 files changed, 55 insertions(+), 84 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 738ec2bf..3b0f2960 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -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; } } diff --git a/app/assets/stylesheets/gitlab_bootstrap/blocks.scss b/app/assets/stylesheets/gitlab_bootstrap/blocks.scss index 898d68bd..f1d2b85f 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/blocks.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/blocks.scss @@ -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; diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 99ea9ef2..6b21f463 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -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 diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index d03fbadf..f48425bd 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -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, diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 2fa9d21d..425dd471 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -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 diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 9114febd..1d4d6a13 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -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 diff --git a/app/views/merge_requests/show/_mr_box.html.haml b/app/views/merge_requests/show/_mr_box.html.haml index 26636435..f64182c6 100644 --- a/app/views/merge_requests/show/_mr_box.html.haml +++ b/app/views/merge_requests/show/_mr_box.html.haml @@ -1,22 +1,16 @@ .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. diff --git a/app/views/merge_requests/show/_mr_title.html.haml b/app/views/merge_requests/show/_mr_title.html.haml index a5275650..745dc93f 100644 --- a/app/views/merge_requests/show/_mr_title.html.haml +++ b/app/views/merge_requests/show/_mr_title.html.haml @@ -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"