diff --git a/app/helpers/commit_helper.rb b/app/helpers/commit_helper.rb
new file mode 100644
index 000000000..10bb80a09
--- /dev/null
+++ b/app/helpers/commit_helper.rb
@@ -0,0 +1,25 @@
+module CommitHelper
+
+ def render_commit_stats(stats)
+ res = ["
"]
+ stats.files.each do |filename, adds, deletes, total|
+ res << "- "
+ res << "#{h(filename)} #{total} "
+ res << "#{(0...deletes).map{|i| "-" }.join}"
+ res << "#{(0...adds).map{|i| "+" }.join}"
+ res << "
"
+ end
+ res << "
"
+
+ res.join("\n")
+ end
+
+ def format_commit_message(message)
+ h(message).gsub("\n", "
")
+ end
+
+ def commit_date(date)
+ I18n.localize(date, { :format => "%d %B %Y" })
+ end
+
+end
\ No newline at end of file
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
new file mode 100644
index 000000000..f6b9a9c8f
--- /dev/null
+++ b/app/helpers/diff_helper.rb
@@ -0,0 +1,36 @@
+module DiffHelper
+ def render_inline_diff(commit, diff)
+ [render_inline_diff_header(commit, diff), render_inline_diff_body(diff.diff), render_inline_diff_footer].join("\n")
+ end
+
+ def render_inline_diff_header(commit, diff)
+ res = ""
+ if diff.b_path.present?
+ res += link_to("view file @ #{commit.id}", blob_commit_path(@platform.name, @project.name, commit.id, diff.b_path))
+ res += "
"
+ end
+
+ res += "
+
+
+
+ |
+ |
+ |
+
+ "
+
+ res
+ end
+
+ def render_inline_diff_body(diff)
+ diff_display ||= Diff::Display::Unified.new(diff)
+ "
+ #{diff_display.render(Git::Diff::InlineCallback.new)}
+ "
+ end
+
+ def render_inline_diff_footer
+ "
"
+ end
+end
\ No newline at end of file