summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorClement Ho <clementh@hp.com>2016-07-25 23:49:06 -0500
committerClement Ho <clementh@hp.com>2016-08-02 11:40:44 -0500
commite4c517a635b6a45a9afc65b37682cc4b4951e922 (patch)
treedc8b1a82b60376ff2deca3e474397547147c84e8 /app/models
parentb6dc87cb28058fdc2d5a735f896742fecb5901ec (diff)
downloadgitlab-ce-e4c517a635b6a45a9afc65b37682cc4b4951e922.tar.gz
Expand commit message width in repo view
Diffstat (limited to 'app/models')
-rw-r--r--app/models/commit.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 486ad6714d9..c52b4a051c2 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -123,15 +123,17 @@ class Commit
# In case this first line is longer than 100 characters, it is cut off
# after 80 characters and ellipses (`&hellp;`) are appended.
def title
- title = safe_message
+ full_title.length > 100 ? full_title[0..79] << "…" : full_title
+ end
- return no_commit_message if title.blank?
+ # Returns the full commits title
+ def full_title
+ return @full_title if @full_title
- title_end = title.index("\n")
- if (!title_end && title.length > 100) || (title_end && title_end > 100)
- title[0..79] << "…"
+ if safe_message.blank?
+ @full_title = no_commit_message
else
- title.split("\n", 2).first
+ @full_title = safe_message.split("\n", 2).first
end
end