summaryrefslogtreecommitdiff
path: root/app/decorators
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-07-21 19:37:31 +0200
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-07-21 19:59:55 +0200
commitff40b7de7a6451bb9e3bc12a18070bbff13b6a68 (patch)
treeeef3353dae91edd66353f4f899df5243232b2f3a /app/decorators
parent8b7e404b5b6944e9c92cc270b2e5d0005781d49d (diff)
downloadgitlab-ce-ff40b7de7a6451bb9e3bc12a18070bbff13b6a68.tar.gz
Add CommitDecorator#short_id
Diffstat (limited to 'app/decorators')
-rw-r--r--app/decorators/commit_decorator.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/decorators/commit_decorator.rb b/app/decorators/commit_decorator.rb
index cc8fa97587b..d9c880bee72 100644
--- a/app/decorators/commit_decorator.rb
+++ b/app/decorators/commit_decorator.rb
@@ -1,6 +1,10 @@
class CommitDecorator < ApplicationDecorator
decorates :commit
+ def short_id(length = 10)
+ id.to_s[0..length]
+ end
+
# Returns the commits title.
#
# Usually, the commit title is the first line of the commit message.