gitlabhq/app/helpers/commits_helper.rb
Cedric Gatay 89a03a3453 1/ rspec'ed
2/ @commit.safe_message as an argument
3/ preserve in helper
4/ spaces around operators
2011-12-27 00:37:27 +01:00

47 lines
1.1 KiB
Ruby

module CommitsHelper
def old_line_number(line, i)
end
def new_line_number(line, i)
end
def diff_line_class(line)
if line[0] == "+"
"new"
elsif line[0] == "-"
"old"
else
nil
end
end
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),
:remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link"
end
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))
rescue
out += $1
end
else
out += m
end
end
preserve out
end
end