OSDN Git Service

Show only first line of commit message on dashboard
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fri, 1 Nov 2013 07:36:59 +0000 (09:36 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fri, 1 Nov 2013 07:36:59 +0000 (09:36 +0200)
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/helpers/events_helper.rb
app/views/events/_commit.html.haml

index cd8761a..4aeb657 100644 (file)
@@ -127,4 +127,10 @@ module EventsHelper
     text = truncate(text, length: 150)
     sanitize(markdown(text), tags: %w(a img b pre p))
   end
+
+  def event_commit_title(message)
+    escape_once(truncate(message.split("\n").first, length: 70))
+  rescue
+    "--broken encoding"
+  end
 end
index 4d4b240..135320d 100644 (file)
@@ -2,4 +2,4 @@
   .commit-row-title
     = link_to commit[:id][0..8], project_commit_path(project, commit[:id]), class: "commit_short_id", alt: ''
     &nbsp;
-    = gfm escape_once(truncate(commit[:message], length: 70)) rescue "--broken encoding"
+    = gfm event_commit_title(commit[:message])