summaryrefslogtreecommitdiff
path: root/app/helpers/commits_helper.rb
diff options
context:
space:
mode:
authorgitlabhq <m@gitlabhq.com>2011-10-09 00:36:38 +0300
committergitlabhq <m@gitlabhq.com>2011-10-09 00:36:38 +0300
commit9ba1224867665844b117fa037e1465bb706b3685 (patch)
tree52fbfc1cdb55df21843965479c97be0c91121a9a /app/helpers/commits_helper.rb
parent93efff945215a4407afcaf0cba15ac601b56df0d (diff)
downloadgitlab-ce-9ba1224867665844b117fa037e1465bb706b3685.tar.gz
init commit
Diffstat (limited to 'app/helpers/commits_helper.rb')
-rw-r--r--app/helpers/commits_helper.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
new file mode 100644
index 00000000000..f1b546684f0
--- /dev/null
+++ b/app/helpers/commits_helper.rb
@@ -0,0 +1,24 @@
+module CommitsHelper
+ def diff_line(line, line_new = 0, line_old = 0)
+ full_line = html_escape(line.gsub(/\n/, ''))
+ color = if line[0] == "+"
+ full_line = "<span class=\"old_line\">&nbsp;</span><span class=\"new_line\">#{line_new}</span> " + full_line
+ "#DFD"
+ elsif line[0] == "-"
+ full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">&nbsp;</span> " + full_line
+ "#FDD"
+ else
+ 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