Commit header improved. finalize PR 667
This commit is contained in:
parent
a7ed8276d7
commit
c0df0cd70c
|
@ -745,7 +745,7 @@ p.time {
|
||||||
.top_box_content,
|
.top_box_content,
|
||||||
.middle_box_content,
|
.middle_box_content,
|
||||||
.bottom_box_content {
|
.bottom_box_content {
|
||||||
padding:20px;
|
padding:15px;
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
|
|
|
@ -1,47 +1,42 @@
|
||||||
.commit-head {
|
.commit-box {
|
||||||
@extend .main_box;
|
@extend .main_box;
|
||||||
|
|
||||||
padding: 14px;
|
.commit-head {
|
||||||
padding-bottom: 8px;
|
@extend .top_box_content;
|
||||||
line-height: 24px;
|
|
||||||
|
.commit-title {
|
||||||
|
line-height: 26px;
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commit-description {
|
||||||
|
font-size: 14px;
|
||||||
|
border: none;
|
||||||
|
background-color: white;
|
||||||
|
padding-top:10px;
|
||||||
|
}
|
||||||
|
|
||||||
.browse-button {
|
.browse-button {
|
||||||
@extend .btn;
|
@extend .btn;
|
||||||
@extend .btn-small;
|
@extend .btn-small;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.commit-title {
|
|
||||||
line-height: 26px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.commit-description {
|
|
||||||
font-size: 14px;
|
|
||||||
padding: 0px;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
border: none;
|
|
||||||
background-color: white;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.commit-info {
|
.commit-info {
|
||||||
@extend .middle_box_content;
|
@extend .middle_box_content;
|
||||||
@extend .clearfix;
|
@extend .clearfix;
|
||||||
|
|
||||||
padding-bottom: 8px;
|
|
||||||
padding-top: 8px;
|
|
||||||
|
|
||||||
margin-left: -14px;
|
|
||||||
margin-right: -14px;
|
|
||||||
margin-bottom: -8px;
|
|
||||||
|
|
||||||
.author .name, .committer .name {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.sha-block {
|
.sha-block {
|
||||||
float: right;
|
text-align:right;
|
||||||
margin-left: 10px
|
&:first-child {
|
||||||
|
padding-bottom:6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
border-bottom: 1px solid #aaa;
|
||||||
|
margin-left: 9px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.merge-commit .sha-block {
|
&.merge-commit .sha-block {
|
||||||
|
@ -53,6 +48,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
margin-right: 4px;
|
margin-right: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,6 +29,8 @@ class CommitsController < ApplicationController
|
||||||
|
|
||||||
git_not_found! and return unless @commit
|
git_not_found! and return unless @commit
|
||||||
|
|
||||||
|
@commit = CommitDecorator.decorate(@commit)
|
||||||
|
|
||||||
@note = @project.build_commit_note(@commit)
|
@note = @project.build_commit_note(@commit)
|
||||||
@comments_allowed = true
|
@comments_allowed = true
|
||||||
@line_notes = project.commit_line_notes(@commit)
|
@line_notes = project.commit_line_notes(@commit)
|
||||||
|
|
|
@ -1,6 +1,32 @@
|
||||||
class CommitDecorator < ApplicationDecorator
|
class CommitDecorator < ApplicationDecorator
|
||||||
decorates :commit
|
decorates :commit
|
||||||
|
|
||||||
|
# Returns the commits title.
|
||||||
|
#
|
||||||
|
# Usually, the commit title is the first line of the commit message.
|
||||||
|
# In case this first line is longer than 80 characters, it is cut off
|
||||||
|
# after 70 characters and ellipses (`&hellp;`) are appended.
|
||||||
|
def title
|
||||||
|
title_end = safe_message.index(/\n/)
|
||||||
|
if (!title_end && safe_message.length > 80) || (title_end && title_end > 80)
|
||||||
|
safe_message[0..69] << "…".html_safe
|
||||||
|
else
|
||||||
|
safe_message.split(/\n/, 2).first
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the commits description
|
||||||
|
#
|
||||||
|
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
|
||||||
|
def description
|
||||||
|
title_end = safe_message.index(/\n/)
|
||||||
|
if (!title_end && safe_message.length > 80) || (title_end && title_end > 80)
|
||||||
|
"…".html_safe << safe_message[70..-1]
|
||||||
|
else
|
||||||
|
safe_message.split(/\n/, 2)[1].try(:chomp)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def breadcrumbs
|
def breadcrumbs
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -106,36 +106,6 @@ class Commit
|
||||||
utf8 author.name
|
utf8 author.name
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the commits title.
|
|
||||||
#
|
|
||||||
# Usually, the commit title is the first line of the commit message.
|
|
||||||
# In case this first line is longer than 80 characters, it is cut off
|
|
||||||
# after 70 characters and ellipses (`&hellp;`) are appended.
|
|
||||||
#
|
|
||||||
# @todo This might be better placed in a view helper.
|
|
||||||
def title
|
|
||||||
title_end = safe_message.index(/\n/)
|
|
||||||
if (!title_end && safe_message.length > 80) || (title_end && title_end > 80)
|
|
||||||
safe_message[0..69] << "…".html_safe
|
|
||||||
else
|
|
||||||
safe_message.split(/\n/, 2).first
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the commits description
|
|
||||||
#
|
|
||||||
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
|
|
||||||
#
|
|
||||||
# @todo This might be better placed in a view helper.
|
|
||||||
def description
|
|
||||||
title_end = safe_message.index(/\n/)
|
|
||||||
if (!title_end && safe_message.length > 80) || (title_end && title_end > 80)
|
|
||||||
"…".html_safe << safe_message[70..-1]
|
|
||||||
else
|
|
||||||
safe_message.split(/\n/, 2)[1].try(:chomp)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Was this commit committed by a different person than the original author?
|
# Was this commit committed by a different person than the original author?
|
||||||
def different_committer?
|
def different_committer?
|
||||||
author_name != committer_name || author_email != committer_email
|
author_name != committer_name || author_email != committer_email
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
.commit-head{class: @commit.parents.count > 1 ? "merge-commit" : ""}
|
.commit-box{class: @commit.parents.count > 1 ? "merge-commit" : ""}
|
||||||
|
.commit-head
|
||||||
= link_to "Browse Code »", tree_project_ref_path(@project, @commit.id), :class => "browse-button"
|
= link_to "Browse Code »", tree_project_ref_path(@project, @commit.id), :class => "browse-button"
|
||||||
%h3.commit-title
|
%h3.commit-title
|
||||||
= commit_msg_with_link_to_issues(@project, @commit.title)
|
= commit_msg_with_link_to_issues(@project, @commit.title)
|
||||||
|
@ -6,25 +7,29 @@
|
||||||
%pre.commit-description
|
%pre.commit-description
|
||||||
= commit_msg_with_link_to_issues(@project, @commit.description)
|
= commit_msg_with_link_to_issues(@project, @commit.description)
|
||||||
.commit-info
|
.commit-info
|
||||||
%span.sha-block
|
.row
|
||||||
commit
|
.span4
|
||||||
%code= @commit.id
|
= image_tag gravatar_icon(@commit.author_email, 40), :class => "avatar"
|
||||||
%span.sha-block
|
|
||||||
= pluralize(@commit.parents.count, "parent")
|
|
||||||
- @commit.parents.each do |parent|
|
|
||||||
%code= link_to parent.id, project_commit_path(@project, parent)
|
|
||||||
.author
|
.author
|
||||||
= image_tag gravatar_icon(@commit.author_email, 24), :class => "avatar", :height => 24, :width => 24
|
%strong= @commit.author_name
|
||||||
%span.name= @commit.author_name
|
|
||||||
authored
|
authored
|
||||||
%time{title: @commit.authored_date.stamp("Aug 21, 2011 9:23pm")}
|
%time{title: @commit.authored_date.stamp("Aug 21, 2011 9:23pm")}
|
||||||
#{time_ago_in_words(@commit.authored_date)} ago
|
#{time_ago_in_words(@commit.authored_date)} ago
|
||||||
- if @commit.different_committer?
|
- if @commit.different_committer?
|
||||||
.committer
|
.committer
|
||||||
%span.name= @commit.committer_name
|
→
|
||||||
|
%strong= @commit.committer_name
|
||||||
committed
|
committed
|
||||||
%time{title: @commit.committed_date.stamp("Aug 21, 2011 9:23pm")}
|
%time{title: @commit.committed_date.stamp("Aug 21, 2011 9:23pm")}
|
||||||
#{time_ago_in_words(@commit.committed_date)} ago
|
#{time_ago_in_words(@commit.committed_date)} ago
|
||||||
|
.span7.right
|
||||||
|
.sha-block
|
||||||
|
%span.cgray commit
|
||||||
|
%code= @commit.id
|
||||||
|
.sha-block
|
||||||
|
%span.cgray= pluralize(@commit.parents.count, "parent")
|
||||||
|
- @commit.parents.each do |parent|
|
||||||
|
= link_to parent.id[0...10], project_commit_path(@project, parent)
|
||||||
|
|
||||||
= render "commits/diffs", :diffs => @commit.diffs
|
= render "commits/diffs", :diffs => @commit.diffs
|
||||||
= render "notes/notes", :tid => @commit.id, :tt => "commit"
|
= render "notes/notes", :tid => @commit.id, :tt => "commit"
|
||||||
|
|
Loading…
Reference in a new issue