summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-04-16 01:10:09 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-04-16 01:10:09 +0300
commitc0df0cd70c9036c2b3bf11f823d61a3618e6d16a (patch)
tree969389cc82a91f1abe10b0422590525712f84d66
parenta7ed8276d7d9448f454f7bbfe8b4a3fb305ae446 (diff)
downloadgitlab-ce-c0df0cd70c9036c2b3bf11f823d61a3618e6d16a.tar.gz
Commit header improved. finalize PR 667
-rw-r--r--app/assets/stylesheets/common.scss2
-rw-r--r--app/assets/stylesheets/sections/commits.scss78
-rw-r--r--app/controllers/commits_controller.rb2
-rw-r--r--app/decorators/commit_decorator.rb26
-rw-r--r--app/models/commit.rb30
-rw-r--r--app/views/commits/show.html.haml57
6 files changed, 97 insertions, 98 deletions
diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss
index ec066d5bda1..90d793ec6be 100644
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -745,7 +745,7 @@ p.time {
.top_box_content,
.middle_box_content,
.bottom_box_content {
- padding:20px;
+ padding:15px;
pre {
background: none !important;
diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss
index 85e7315ec89..9f6488ba78a 100644
--- a/app/assets/stylesheets/sections/commits.scss
+++ b/app/assets/stylesheets/sections/commits.scss
@@ -1,58 +1,54 @@
-.commit-head {
+.commit-box {
@extend .main_box;
- padding: 14px;
- padding-bottom: 8px;
- line-height: 24px;
+ .commit-head {
+ @extend .top_box_content;
- .browse-button {
- @extend .btn;
- @extend .btn-small;
- float: right;
- }
+ .commit-title {
+ line-height: 26px;
+ margin:0;
+ }
- .commit-title {
- line-height: 26px;
- }
+ .commit-description {
+ font-size: 14px;
+ border: none;
+ background-color: white;
+ padding-top:10px;
+ }
- .commit-description {
- font-size: 14px;
- padding: 0px;
- padding-bottom: 4px;
- border: none;
- background-color: white;
+ .browse-button {
+ @extend .btn;
+ @extend .btn-small;
+ float: right;
+ }
}
.commit-info {
@extend .middle_box_content;
@extend .clearfix;
- padding-bottom: 8px;
- padding-top: 8px;
-
- margin-left: -14px;
- margin-right: -14px;
- margin-bottom: -8px;
+ .sha-block {
+ text-align:right;
+ &:first-child {
+ padding-bottom:6px;
+ }
- .author .name, .committer .name {
- font-weight: bold;
+ a {
+ border-bottom: 1px solid #aaa;
+ margin-left: 9px;
+ }
}
- }
- .sha-block {
- float: right;
- margin-left: 10px
- }
-
- &.merge-commit .sha-block {
- clear: right;
- }
+ &.merge-commit .sha-block {
+ clear: right;
+ }
- .committer {
- padding-left: 32px;
- }
+ .committer {
+ padding-left: 32px;
+ }
- .avatar {
- margin-right: 4px;
+ .avatar {
+ margin-right: 10px;
+ }
}
-} \ No newline at end of file
+}
diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb
index 9063fbf8ebc..061592a3b01 100644
--- a/app/controllers/commits_controller.rb
+++ b/app/controllers/commits_controller.rb
@@ -29,6 +29,8 @@ class CommitsController < ApplicationController
git_not_found! and return unless @commit
+ @commit = CommitDecorator.decorate(@commit)
+
@note = @project.build_commit_note(@commit)
@comments_allowed = true
@line_notes = project.commit_line_notes(@commit)
diff --git a/app/decorators/commit_decorator.rb b/app/decorators/commit_decorator.rb
index e4dc027a179..348d1e93bfc 100644
--- a/app/decorators/commit_decorator.rb
+++ b/app/decorators/commit_decorator.rb
@@ -1,6 +1,32 @@
class CommitDecorator < ApplicationDecorator
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] << "&hellip;".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)
+ "&hellip;".html_safe << safe_message[70..-1]
+ else
+ safe_message.split(/\n/, 2)[1].try(:chomp)
+ end
+ end
+
def breadcrumbs
end
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 343235e58af..f90c42672db 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -106,36 +106,6 @@ class Commit
utf8 author.name
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] << "&hellip;".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)
- "&hellip;".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?
def different_committer?
author_name != committer_name || author_email != committer_email
diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml
index eae8c804c81..d177b905977 100644
--- a/app/views/commits/show.html.haml
+++ b/app/views/commits/show.html.haml
@@ -1,30 +1,35 @@
-.commit-head{class: @commit.parents.count > 1 ? "merge-commit" : ""}
- = link_to "Browse Code »", tree_project_ref_path(@project, @commit.id), :class => "browse-button"
- %h3.commit-title
- = commit_msg_with_link_to_issues(@project, @commit.title)
- - if @commit.description.present?
- %pre.commit-description
- = commit_msg_with_link_to_issues(@project, @commit.description)
+.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"
+ %h3.commit-title
+ = commit_msg_with_link_to_issues(@project, @commit.title)
+ - if @commit.description.present?
+ %pre.commit-description
+ = commit_msg_with_link_to_issues(@project, @commit.description)
.commit-info
- %span.sha-block
- commit
- %code= @commit.id
- %span.sha-block
- = pluralize(@commit.parents.count, "parent")
- - @commit.parents.each do |parent|
- %code= link_to parent.id, project_commit_path(@project, parent)
- .author
- = image_tag gravatar_icon(@commit.author_email, 24), :class => "avatar", :height => 24, :width => 24
- %span.name= @commit.author_name
- authored
- %time{title: @commit.authored_date.stamp("Aug 21, 2011 9:23pm")}
- #{time_ago_in_words(@commit.authored_date)} ago
- - if @commit.different_committer?
- .committer
- %span.name= @commit.committer_name
- committed
- %time{title: @commit.committed_date.stamp("Aug 21, 2011 9:23pm")}
- #{time_ago_in_words(@commit.committed_date)} ago
+ .row
+ .span4
+ = image_tag gravatar_icon(@commit.author_email, 40), :class => "avatar"
+ .author
+ %strong= @commit.author_name
+ authored
+ %time{title: @commit.authored_date.stamp("Aug 21, 2011 9:23pm")}
+ #{time_ago_in_words(@commit.authored_date)} ago
+ - if @commit.different_committer?
+ .committer
+ &rarr;
+ %strong= @commit.committer_name
+ committed
+ %time{title: @commit.committed_date.stamp("Aug 21, 2011 9:23pm")}
+ #{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 "notes/notes", :tid => @commit.id, :tt => "commit"