Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <clementh@hp.com>2016-07-26 07:49:06 +0300
committerClement Ho <clementh@hp.com>2016-08-02 19:40:44 +0300
commite4c517a635b6a45a9afc65b37682cc4b4951e922 (patch)
treedc8b1a82b60376ff2deca3e474397547147c84e8 /app/models/commit.rb
parentb6dc87cb28058fdc2d5a735f896742fecb5901ec (diff)
Expand commit message width in repo view
Diffstat (limited to 'app/models/commit.rb')
-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