Commit 784aa266 authored by Sato Hiroyuki's avatar Sato Hiroyuki

Refactor: grouping parent and their space by including array.

parent 2f7f46b2
......@@ -117,7 +117,7 @@
// Draw lines
for (var j = 0, jj = this.commits[i].parents.length; j < jj; j++) {
c = this.preparedCommits[this.commits[i].parents[j][0]];
ps = this.commits[i].parent_spaces[j];
ps = this.commits[i].parents[j][1];
if (c) {
var cx = offsetX + 20 * c.time
, cy = offsetY + 10 * c.space
......
......@@ -2,4 +2,9 @@ module GraphHelper
def join_with_space(ary)
ary.collect{|r|r.name}.join(" ") unless ary.nil?
end
def parents_zip_spaces(parents, parent_spaces)
ids = parents.map { |p| p.id }
ids.zip(parent_spaces)
end
end
......@@ -5,9 +5,7 @@
days: @graph.days.compact.map { |d| [d.day, d.strftime("%b")] },
commits: @graph.commits.map do |c|
{
parents: c.parents.collect do |p|
[p.id,0,0]
end,
parents: parents_zip_spaces(c.parents, c.parent_spaces),
author: {
name: c.author.name,
email: c.author.email,
......@@ -15,7 +13,6 @@
},
time: c.time,
space: c.spaces.first,
parent_spaces: c.parent_spaces,
refs: join_with_space(c.refs),
id: c.sha,
date: c.date,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment