diff options
author | Cedric Gatay <cedric@gatay.fr> | 2011-12-26 23:22:15 +0100 |
---|---|---|
committer | Cedric Gatay <cedric@gatay.fr> | 2011-12-27 00:37:27 +0100 |
commit | 89a03a3453c988bc15fe837aefaa1c2b2d215ace (patch) | |
tree | 0848d3dae0c41b41c0fa2065d98d548d377338f4 /app | |
parent | 5d9f2e7d1582cce02648c54c373083fc8c1f70c8 (diff) | |
download | gitlab-ce-89a03a3453c988bc15fe837aefaa1c2b2d215ace.tar.gz |
1/ rspec'ed
2/ @commit.safe_message as an argument
3/ preserve in helper
4/ spaces around operators
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/commits_helper.rb | 19 | ||||
-rw-r--r-- | app/views/commits/show.html.haml | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index a18db9df73e..559508d900f 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -20,26 +20,27 @@ module CommitsHelper def more_commits_link offset = params[:offset] || 0 limit = params[:limit] || 100 - link_to "More", project_commits_path(@project, :offset => offset.to_i + limit.to_i, :limit => limit), + link_to "More", project_commits_path(project, :offset => offset.to_i + limit.to_i, :limit => limit), :remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link" end - def commit_msg_with_link_to_issues - out = "" - @commit.safe_message.split(/(#[0-9]+)/m).each do |m| + def commit_msg_with_link_to_issues(project, message) + return '' unless message + out = '' + message.split(/(#[0-9]+)/m).each do |m| if m =~ /(#([0-9]+))/m begin issue = Issue.find($2) - raise Exception('Issue not belonging to current project, not creating link !') unless issue.project_id == @project.id - out+=link_to($1, project_issue_path(@project, $2)) + raise Exception('Issue not belonging to current project, not creating link !') unless issue.project_id == project.id + out += link_to($1, project_issue_path(project, $2)) rescue - out+=$1 + out += $1 end else - out+= m + out += m end end - out + preserve out end end diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml index 2a6b85bf0fe..44b7b8fa293 100644 --- a/app/views/commits/show.html.haml +++ b/app/views/commits/show.html.haml @@ -18,7 +18,7 @@ %hr %pre.commit_message - = preserve commit_msg_with_link_to_issues + = commit_msg_with_link_to_issues(@project, @commit.safe_message) .clear %br |