2011-10-08 23:36:38 +02:00
|
|
|
module CommitsHelper
|
2011-12-01 00:51:04 +01:00
|
|
|
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
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def more_commits_link
|
|
|
|
offset = params[:offset] || 0
|
|
|
|
limit = params[:limit] || 100
|
2011-12-27 00:39:42 +01:00
|
|
|
link_to "More", project_commits_path(@project, :offset => offset.to_i + limit.to_i, :limit => limit),
|
2011-10-08 23:36:38 +02:00
|
|
|
:remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link"
|
|
|
|
end
|
2011-12-26 21:35:25 +01:00
|
|
|
|
2011-12-26 23:22:15 +01:00
|
|
|
def commit_msg_with_link_to_issues(project, message)
|
|
|
|
return '' unless message
|
|
|
|
out = ''
|
|
|
|
message.split(/(#[0-9]+)/m).each do |m|
|
2011-12-26 21:35:25 +01:00
|
|
|
if m =~ /(#([0-9]+))/m
|
|
|
|
begin
|
2011-12-28 00:06:55 +01:00
|
|
|
issue = project.issues.find($2)
|
2011-12-26 23:22:15 +01:00
|
|
|
out += link_to($1, project_issue_path(project, $2))
|
2011-12-26 21:35:25 +01:00
|
|
|
rescue
|
2011-12-26 23:22:15 +01:00
|
|
|
out += $1
|
2011-12-26 21:35:25 +01:00
|
|
|
end
|
|
|
|
else
|
2011-12-26 23:22:15 +01:00
|
|
|
out += m
|
2011-12-26 21:35:25 +01:00
|
|
|
end
|
|
|
|
end
|
2011-12-26 23:22:15 +01:00
|
|
|
preserve out
|
2011-12-26 21:35:25 +01:00
|
|
|
end
|
|
|
|
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|