Commit 40d619107f9027a33eccc01afa120f7b588e5cf9

Authored by Robert Speicher
1 parent 8db2a59d

Add link_title to CommitDecorator

app/decorators/commit_decorator.rb
1 1 class CommitDecorator < ApplicationDecorator
2 2 decorates :commit
3 3  
  4 + # Returns a string describing the commit for use in a link title
  5 + #
  6 + # Example
  7 + #
  8 + # "Commit: Alex Denisov - Project git clone panel"
  9 + def link_title
  10 + "Commit: #{author_name} - #{title}"
  11 + end
  12 +
4 13 # Returns the commits title.
5 14 #
6 15 # Usually, the commit title is the first line of the commit message.
... ...
lib/gitlab/markdown.rb
... ... @@ -100,7 +100,7 @@ module Gitlab
100 100  
101 101 def reference_commit(identifier)
102 102 if commit = @project.commit(identifier)
103   - link_to(identifier, project_commit_path(@project, id: commit.id), html_options.merge(title: "Commit: #{commit.author_name} - #{CommitDecorator.new(commit).title}", class: "gfm gfm-commit #{html_options[:class]}"))
  103 + link_to(identifier, project_commit_path(@project, id: commit.id), html_options.merge(title: CommitDecorator.new(commit).link_title, class: "gfm gfm-commit #{html_options[:class]}"))
104 104 end
105 105 end
106 106 end
... ...