summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gerhardt <code@dgerhardt.net>2015-07-26 11:01:29 +0200
committerDaniel Gerhardt <code@dgerhardt.net>2015-07-29 16:16:19 +0200
commit15f17f7916427e10300b443f787256a9f26b5820 (patch)
treeca887e4ee5a4423d5ce5ffaf19951c0271b8dda8
parentf1db513a69503e652ab26cc4f985d9c6588c65cb (diff)
downloadgitlab-ci-15f17f7916427e10300b443f787256a9f26b5820.tar.gz
Truncate commit messages after subject line in table
Commit messages are now additionally truncated after the first line. Before, a commit message's body was attached behind the subject which made messages hardly readable in some cases.
-rw-r--r--CHANGELOG1
-rw-r--r--app/helpers/commits_helper.rb4
-rw-r--r--app/views/commits/_commit.html.haml3
3 files changed, 6 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 5db1a17..73b1521 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,5 @@
v7.14.0 (unreleased)
+ - Truncate commit messages after subject line in table
- Adjust CI config to support Docker executors
v7.13.1
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index b94cfaf..37a9f34 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -15,4 +15,8 @@ module CommitsHelper
def commit_link(commit)
link_to(commit.short_sha, project_ref_commit_path(commit.project, commit.ref, commit.sha))
end
+
+ def truncate_first_line(message, length = 50)
+ truncate(message.lines.first.chomp, length: length)
+ end
end
diff --git a/app/views/commits/_commit.html.haml b/app/views/commits/_commit.html.haml
index 7fae74e..a273f09 100644
--- a/app/views/commits/_commit.html.haml
+++ b/app/views/commits/_commit.html.haml
@@ -11,7 +11,7 @@
%strong #{commit.short_sha}
%td.build-message
- %span= truncate(commit.git_commit_message, length: 50)
+ %span= truncate_first_line(commit.git_commit_message)
%td.build-branch
- unless @ref
@@ -30,4 +30,3 @@
%td.coverage
- if commit.coverage
#{commit.coverage}%
-