diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2015-07-30 09:56:47 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2015-07-30 09:56:47 +0000 |
commit | 6ec3f9873a61449e50521face3a1b32b03eb9feb (patch) | |
tree | 03afd96dd270b55ab19b9b78d1aa8085e349fd42 | |
parent | 42f9bb0e23f7a98e4d2928916783a83fd5965e7b (diff) | |
parent | 15f17f7916427e10300b443f787256a9f26b5820 (diff) | |
download | gitlab-ci-6ec3f9873a61449e50521face3a1b32b03eb9feb.tar.gz |
Merge branch 'truncate-commitmsg-at-newline' into 'master'
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.
![gitlab-ci-truncate-commitmsg](https://gitlab.com/dgerhardt/gitlab-ci/uploads/a0c601eb1abbce7a7b9e4e0e3f16f303/gitlab-ci-truncate-commitmsg.png)
See merge request !213
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/helpers/commits_helper.rb | 4 | ||||
-rw-r--r-- | app/views/commits/_commit.html.haml | 3 |
3 files changed, 6 insertions, 2 deletions
@@ -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}% - |