0
@@ -57,7 +57,7 @@ module ApplicationHelper
0
def gravatar_url_for(email, options = {})
0
- "http://www.gravatar.com/avatar.php?
default=/images/default_face.png&gravatar_id=" <<
0
+ "http://www.gravatar.com/avatar.php?
gravatar_id=" <<
0
Digest::MD5.hexdigest(email) <<
0
options.map { |k,v| "&#{k}=#{v}" }.join
0
@@ -79,94 +79,42 @@ module ApplicationHelper
0
flash.map { |type, content| content_tag(:div, content_tag(:p, content), :class => "flash_message #{type}")}
0
- def commit_graph_tag(project, sha = "master", width = 250, height = 150)
0
- repo = project.repositories.first
0
+ def commit_graph_tag(repository, sha = "master", width = 650, height = 110)
0
+ labels, commits = repository.commit_graph_data(sha)
0
+ return if commits.blank?
0
+ # "<pre>#{labels.inspect}\n#{commits.inspect}</pre>" +
0
- data = git.rev_list({:pretty => "format:%at", :since => "24 weeks ago"}, sha)
0
- data.each_line { |line|
0
- date = Time.at(line.to_i)
0
- dategroup = Date.new(date.year, date.month, 1)
0
+ labels.each_with_index do |week, index|
0
+ label_names << "Week #{week}"
0
- labels << date.strftime("%b") # + "[#{value}]"
0
- Gchart.bar(:data => commits, :labels => labels, :width => width, :height => height, :bg => "efefef", :format => "img_tag", :axis_with_labels => ['x'], :axis_labels => [commits], :bar_colors => 'FFDBA3')
0
+ :title => "Commits by week (24 week period)",
0
+ :data => [0] + commits,
0
+ :axis_with_labels => ["y", "x"],
0
+ :axis_labels => ["0|#{commits.max}", label_names.join("|")],
0
+ :bar_colors => "9cce2e",
0
+ :custom => "chm=B,E4E9D4,0,0,0",
0
- def commit_graph_by_author_tag(project, sha = "master", width = 400, height = 200)
0
- repo = project.repositories.first
0
- data = git.rev_list({:pretty => "format:name:%cn", :since => "1 years ago" }, sha)
0
- data.each_line { |line|
0
- if line =~ /^name:(.*)$/ then
0
- sorted = h.sort_by { |author, commits|
0
- top = sorted[sorted.size-max, sorted.size]
0
- others = sorted[0, sorted.size-max]
0
- others_v = others.inject { |v, acum| [v.last + acum.last] }
0
+ def commit_graph_by_author_tag(repos, sha = "master", width = 350, height = 150)
0
+ labels, data = repos.commit_graph_data_by_author
0
- Gchart.pie(:data => data, :labels => labels, :width => width, :height => height, :bg => "efefef", :format => "img_tag" )
0
+ :title => "Commits by author",
0
+ :bar_colors => "9cce2e",
Comments
No one has commented yet.