2011-10-08 23:36:38 +02:00
|
|
|
module CommitsHelper
|
2011-11-28 10:46:41 +01:00
|
|
|
include Utils::CharEncode
|
2011-10-08 23:36:38 +02:00
|
|
|
def diff_line(line, line_new = 0, line_old = 0)
|
|
|
|
full_line = html_escape(line.gsub(/\n/, ''))
|
2011-10-26 15:46:25 +02:00
|
|
|
color = if line[0] == "+"
|
2011-10-08 23:36:38 +02:00
|
|
|
full_line = "<span class=\"old_line\"> </span><span class=\"new_line\">#{line_new}</span> " + full_line
|
|
|
|
"#DFD"
|
2011-10-26 15:46:25 +02:00
|
|
|
elsif line[0] == "-"
|
2011-10-08 23:36:38 +02:00
|
|
|
full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\"> </span> " + full_line
|
|
|
|
"#FDD"
|
2011-10-26 15:46:25 +02:00
|
|
|
else
|
2011-10-08 23:36:38 +02:00
|
|
|
full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">#{line_new}</span> " + full_line
|
|
|
|
"none"
|
|
|
|
end
|
|
|
|
|
|
|
|
raw "<div style=\"white-space:pre;background:#{color};\">#{full_line}</div>"
|
|
|
|
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
|
|
|
|
end
|