From 96a584211bf7bfa87b172b72015d7729b32150cf Mon Sep 17 00:00:00 2001 From: Sato Hiroyuki Date: Tue, 19 Mar 2013 18:08:27 +0900 Subject: [PATCH 1/7] Refactor: Clean up code. --- app/assets/javascripts/branch-graph.js.coffee | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee index 6e4d6931..38735463 100644 --- a/app/assets/javascripts/branch-graph.js.coffee +++ b/app/assets/javascripts/branch-graph.js.coffee @@ -212,10 +212,6 @@ class BranchGraph top.push anchor Raphael::commitTooltip = (x, y, commit) -> - icon = undefined - nameText = undefined - idText = undefined - messageText = undefined boxWidth = 300 boxHeight = 200 icon = @image(commit.author.icon, x, y, 20, 20) From 351c952192da7cdd088fe693289e96d945dcafe3 Mon Sep 17 00:00:00 2001 From: Sato Hiroyuki Date: Tue, 19 Mar 2013 18:42:46 +0900 Subject: [PATCH 2/7] Refactor: extract method. --- app/assets/javascripts/branch-graph.js.coffee | 116 ++++++++++-------- 1 file changed, 63 insertions(+), 53 deletions(-) diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee index 38735463..4a270c49 100644 --- a/app/assets/javascripts/branch-graph.js.coffee +++ b/app/assets/javascripts/branch-graph.js.coffee @@ -53,10 +53,10 @@ class BranchGraph top = r.set() cuday = 0 cumonth = "" - offsetX = 20 - offsetY = 60 + @offsetX = 20 + @offsetY = 60 barWidth = Math.max(graphWidth, @days.length * 20 + 320) - scrollLeft = cw + @scrollLeft = cw @raphael = r r.rect(0, 0, barWidth, 20).attr fill: "#222" r.rect(0, 20, barWidth, 20).attr fill: "#444" @@ -64,7 +64,7 @@ class BranchGraph for day, mm in @days if cuday isnt day[0] # Dates - r.text(offsetX + mm * 20, 31, day[0]) + r.text(@offsetX + mm * 20, 31, day[0]) .attr( font: "12px Monaco, monospace" fill: "#DDD" @@ -73,7 +73,7 @@ class BranchGraph if cumonth isnt day[1] # Months - r.text(offsetX + mm * 20, 11, day[1]) + r.text(@offsetX + mm * 20, 11, day[1]) .attr( font: "12px Monaco, monospace" fill: "#EEE" @@ -81,61 +81,21 @@ class BranchGraph cumonth = day[1] for commit in @commits - x = offsetX + 20 * commit.time - y = offsetY + 10 * commit.space - # Draw dot - r.circle(x, y, 3).attr( - fill: @colors[commit.space] - stroke: "none" - ) + x = @offsetX + 20 * commit.time + y = @offsetY + 10 * commit.space - # Draw lines - for parent in commit.parents - parentCommit = @preparedCommits[parent[0]] - parentX = offsetX + 20 * parentCommit.time - parentY1 = offsetY + 10 * parentCommit.space - parentY2 = offsetY + 10 * parent[1] - if parentCommit.space is commit.space and parentCommit.space is parent[1] - r.path(["M", x, y, "L", parentX, parentY1]).attr( - stroke: @colors[parentCommit.space] - "stroke-width": 2 - ) + @drawDot(x, y, commit) - else if parentCommit.space < commit.space - if y is parentY2 - r.path(["M", x - 5, y, "l-5,-2,0,4,5,-2", "L", x - 10, y, "L", x - 15, parentY2, "L", parentX + 5, parentY2, "L", parentX, parentY1]).attr( - stroke: @colors[commit.space] - "stroke-width": 2 - ) + @drawLines(x, y, commit) - else - r.path(["M", x - 3, y - 6, "l-4,-3,4,-2,0,5", "L", x - 5, y - 10, "L", x - 10, parentY2, "L", parentX + 5, parentY2, "L", parentX, parentY1]).attr( - stroke: @colors[commit.space] - "stroke-width": 2 - ) + @appendLabel(x, y, commit.refs) if commit.refs - else - r.path(["M", x - 3, y + 6, "l-4,3,4,2,0,-5", "L", x - 5, y + 10, "L", x - 10, parentY2, "L", parentX + 5, parentY2, "L", parentX, parentY1]).attr( - stroke: @colors[parentCommit.space] - "stroke-width": 2 - ) + @appendAnchor(top, commit, x, y) - @appendLabel x, y, commit.refs if commit.refs - - # Mark commit and displayed in the center - if commit.id is @options.commit_id - r.path(["M", x, y - 5, "L", x + 4, y - 15, "L", x - 4, y - 15, "Z"]).attr( - fill: "#000" - "fill-opacity": .7 - stroke: "none" - ) - - scrollLeft = x - graphWidth / 2 - - @appendAnchor top, commit, x, y + @markCommit(x, y, commit, graphWidth) top.toFront() - @element.scrollLeft scrollLeft + @element.scrollLeft @scrollLeft @bindEvents() bindEvents: -> @@ -211,6 +171,56 @@ class BranchGraph ) top.push anchor + drawDot: (x, y, commit) -> + r = @raphael + r.circle(x, y, 3).attr( + fill: @colors[commit.space] + stroke: "none" + ) + + drawLines: (x, y, commit) -> + r = @raphael + for parent in commit.parents + parentCommit = @preparedCommits[parent[0]] + parentX = @offsetX + 20 * parentCommit.time + parentY1 = @offsetY + 10 * parentCommit.space + parentY2 = @offsetY + 10 * parent[1] + if parentCommit.space is commit.space and parentCommit.space is parent[1] + r.path(["M", x, y, "L", parentX, parentY1]).attr( + stroke: @colors[parentCommit.space] + "stroke-width": 2 + ) + + else if parentCommit.space < commit.space + if y is parentY2 + r.path(["M", x - 5, y, "l-5,-2,0,4,5,-2", "L", x - 10, y, "L", x - 15, parentY2, "L", parentX + 5, parentY2, "L", parentX, parentY1]).attr( + stroke: @colors[commit.space] + "stroke-width": 2 + ) + + else + r.path(["M", x - 3, y - 6, "l-4,-3,4,-2,0,5", "L", x - 5, y - 10, "L", x - 10, parentY2, "L", parentX + 5, parentY2, "L", parentX, parentY1]).attr( + stroke: @colors[commit.space] + "stroke-width": 2 + ) + + else + r.path(["M", x - 3, y + 6, "l-4,3,4,2,0,-5", "L", x - 5, y + 10, "L", x - 10, parentY2, "L", parentX + 5, parentY2, "L", parentX, parentY1]).attr( + stroke: @colors[parentCommit.space] + "stroke-width": 2 + ) + + markCommit: (x, y, commit, graphWidth) -> + if commit.id is @options.commit_id + r = @raphael + r.path(["M", x, y - 5, "L", x + 4, y - 15, "L", x - 4, y - 15, "Z"]).attr( + fill: "#000" + "fill-opacity": .7 + stroke: "none" + ) + # Displayed in the center + @scrollLeft = x - graphWidth / 2 + Raphael::commitTooltip = (x, y, commit) -> boxWidth = 300 boxHeight = 200 From 175e09f16742cbc8d5535e548cef880768ec3397 Mon Sep 17 00:00:00 2001 From: Sato Hiroyuki Date: Tue, 19 Mar 2013 19:27:15 +0900 Subject: [PATCH 3/7] Change graph element size. --- app/assets/javascripts/branch-graph.js.coffee | 8 ++++---- app/assets/stylesheets/sections/graph.scss | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee index 4a270c49..79ea62af 100644 --- a/app/assets/javascripts/branch-graph.js.coffee +++ b/app/assets/javascripts/branch-graph.js.coffee @@ -47,14 +47,14 @@ class BranchGraph buildGraph: -> graphWidth = $(@element).width() - ch = @mspace * 20 + 100 + ch = @mspace * 10 + 100 cw = Math.max(graphWidth, @mtime * 20 + 260) r = Raphael(@element.get(0), cw, ch) top = r.set() cuday = 0 cumonth = "" @offsetX = 20 - @offsetY = 60 + @offsetY = 50 barWidth = Math.max(graphWidth, @days.length * 20 + 320) @scrollLeft = cw @raphael = r @@ -64,7 +64,7 @@ class BranchGraph for day, mm in @days if cuday isnt day[0] # Dates - r.text(@offsetX + mm * 20, 31, day[0]) + r.text(@offsetX + mm * 20, 30, day[0]) .attr( font: "12px Monaco, monospace" fill: "#DDD" @@ -73,7 +73,7 @@ class BranchGraph if cumonth isnt day[1] # Months - r.text(@offsetX + mm * 20, 11, day[1]) + r.text(@offsetX + mm * 20, 10, day[1]) .attr( font: "12px Monaco, monospace" fill: "#EEE" diff --git a/app/assets/stylesheets/sections/graph.scss b/app/assets/stylesheets/sections/graph.scss index 5800098a..7da00719 100644 --- a/app/assets/stylesheets/sections/graph.scss +++ b/app/assets/stylesheets/sections/graph.scss @@ -12,7 +12,7 @@ .graph { background: #f1f1f1; cursor: move; - height: 70%; + height: 500px; overflow: hidden; } } From 1f6b6b6c629592e3ecc08e9dac6514a4b1a831a0 Mon Sep 17 00:00:00 2001 From: Sato Hiroyuki Date: Wed, 20 Mar 2013 09:17:12 +0000 Subject: [PATCH 4/7] Rotating graph orientation. --- app/assets/javascripts/branch-graph.js.coffee | 113 +++++++++++------- app/models/network/graph.rb | 39 +++--- 2 files changed, 82 insertions(+), 70 deletions(-) diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee index 79ea62af..a3223172 100644 --- a/app/assets/javascripts/branch-graph.js.coffee +++ b/app/assets/javascripts/branch-graph.js.coffee @@ -20,8 +20,6 @@ class BranchGraph prepareData: (@days, @commits) -> @collectParents() - @mtime += 4 - @mspace += 10 for c in @commits c.isParent = true if c.id of @parents @@ -35,6 +33,7 @@ class BranchGraph @mspace = Math.max(@mspace, c.space) for p in c.parents @parents[p[0]] = true + @mspace = Math.max(@mspace, p[1]) collectColors: -> k = 0 @@ -46,25 +45,26 @@ class BranchGraph k++ buildGraph: -> + graphHeight = $(@element).height() graphWidth = $(@element).width() - ch = @mspace * 10 + 100 - cw = Math.max(graphWidth, @mtime * 20 + 260) + ch = Math.max(graphHeight, @mtime * 20 + 100) + cw = Math.max(graphWidth, @mspace * 10 + 260) r = Raphael(@element.get(0), cw, ch) top = r.set() cuday = 0 cumonth = "" - @offsetX = 20 - @offsetY = 50 - barWidth = Math.max(graphWidth, @days.length * 20 + 320) + @offsetX = 120 + @offsetY = 20 + barHeight = Math.max(graphHeight, @days.length * 20 + 320) @scrollLeft = cw @raphael = r - r.rect(0, 0, barWidth, 20).attr fill: "#222" - r.rect(0, 20, barWidth, 20).attr fill: "#444" + r.rect(0, 0, 20, barHeight).attr fill: "#222" + r.rect(20, 0, 20, barHeight).attr fill: "#444" for day, mm in @days if cuday isnt day[0] # Dates - r.text(@offsetX + mm * 20, 30, day[0]) + r.text(30, @offsetY + mm * 20, day[0]) .attr( font: "12px Monaco, monospace" fill: "#DDD" @@ -73,7 +73,7 @@ class BranchGraph if cumonth isnt day[1] # Months - r.text(@offsetX + mm * 20, 10, day[1]) + r.text(10, @offsetY + mm * 20, day[1]) .attr( font: "12px Monaco, monospace" fill: "#EEE" @@ -81,8 +81,8 @@ class BranchGraph cumonth = day[1] for commit in @commits - x = @offsetX + 20 * commit.time - y = @offsetY + 10 * commit.space + x = @offsetX + 10 * (@mspace - commit.space) + y = @offsetY + 20 * commit.time @drawDot(x, y, commit) @@ -92,10 +92,9 @@ class BranchGraph @appendAnchor(top, commit, x, y) - @markCommit(x, y, commit, graphWidth) + @markCommit(x, y, commit, graphHeight) top.toFront() - @element.scrollLeft @scrollLeft @bindEvents() bindEvents: -> @@ -131,26 +130,28 @@ class BranchGraph shortrefs = refs # Truncate if longer than 15 chars shortrefs = shortrefs.substr(0, 15) + "…" if shortrefs.length > 17 - text = r.text(x + 5, y + 8 + 10, shortrefs).attr( + text = r.text(x + 8, y, shortrefs).attr( + "text-anchor": "start" font: "10px Monaco, monospace" fill: "#FFF" title: refs ) textbox = text.getBBox() - text.transform ["t", textbox.height / -4, textbox.width / 2 + 5, "r90"] # Create rectangle based on the size of the textbox - rect = r.rect(x, y, textbox.width + 15, textbox.height + 5, 4).attr( + rect = r.rect(x, y - 7, textbox.width + 15, textbox.height + 5, 4).attr( fill: "#000" - "fill-opacity": .7 + "fill-opacity": .5 stroke: "none" ) - triangle = r.path(["M", x, y + 5, "L", x + 4, y + 15, "L", x - 4, y + 15, "Z"]).attr( + triangle = r.path(["M", x - 5, y, "L", x - 15, y - 4, "L", x - 15, y + 4, "Z"]).attr( fill: "#000" - "fill-opacity": .7 + "fill-opacity": .5 stroke: "none" ) - # Rotate and reposition rectangle over text - rect.transform ["r", 90, x, y, "t", 15, -9] + + label = r.set(rect, text) + label.transform(["t", -rect.getBBox().width - 15, 0]) + # Set text to front text.toFront() @@ -164,7 +165,7 @@ class BranchGraph ).click(-> window.open options.commit_url.replace("%s", commit.id), "_blank" ).hover(-> - @tooltip = r.commitTooltip(x, y + 5, commit) + @tooltip = r.commitTooltip(x + 5, y, commit) top.push @tooltip.insertBefore(this) , -> @tooltip and @tooltip.remove() and delete @tooltip @@ -182,44 +183,66 @@ class BranchGraph r = @raphael for parent in commit.parents parentCommit = @preparedCommits[parent[0]] - parentX = @offsetX + 20 * parentCommit.time - parentY1 = @offsetY + 10 * parentCommit.space - parentY2 = @offsetY + 10 * parent[1] + parentY = @offsetY + 20 * parentCommit.time + parentX1 = @offsetX + 10 * (@mspace - parentCommit.space) + parentX2 = @offsetX + 10 * (@mspace - parent[1]) + if parentCommit.space is commit.space and parentCommit.space is parent[1] - r.path(["M", x, y, "L", parentX, parentY1]).attr( + r.path(["M", x, y, "L", parentX1, parentY]).attr( stroke: @colors[parentCommit.space] "stroke-width": 2 ) else if parentCommit.space < commit.space - if y is parentY2 - r.path(["M", x - 5, y, "l-5,-2,0,4,5,-2", "L", x - 10, y, "L", x - 15, parentY2, "L", parentX + 5, parentY2, "L", parentX, parentY1]).attr( - stroke: @colors[commit.space] - "stroke-width": 2 - ) + if x is parentX2 + r + .path([ + "M", x, y + 5, + "l-2,5,4,0,-2,-5", + "L", x, y + 10, + "L", parentX2, y + 10, + "L", parentX2, parentY - 5, + "L", parentX1, parentY]) + .attr( + stroke: @colors[commit.space] + "stroke-width": 2) else - r.path(["M", x - 3, y - 6, "l-4,-3,4,-2,0,5", "L", x - 5, y - 10, "L", x - 10, parentY2, "L", parentX + 5, parentY2, "L", parentX, parentY1]).attr( - stroke: @colors[commit.space] - "stroke-width": 2 - ) + r + .path([ + "M", x + 3, y + 3, + "l5,0,-2,4,-3,-4", + "L", x + 7, y + 5, + "L", parentX2, y + 10, + "L", parentX2, parentY - 5, + "L", parentX1, parentY]) + .attr( + stroke: @colors[commit.space] + "stroke-width": 2) else - r.path(["M", x - 3, y + 6, "l-4,3,4,2,0,-5", "L", x - 5, y + 10, "L", x - 10, parentY2, "L", parentX + 5, parentY2, "L", parentX, parentY1]).attr( - stroke: @colors[parentCommit.space] - "stroke-width": 2 - ) + r + .path([ + "M", x - 3, y + 3, + "l-5,0,2,4,3,-4", + "L", x - 7, y + 5, + "L", parentX2, y + 10, + "L", parentX2, parentY - 5, + "L", parentX1, parentY]) + .attr( + stroke: @colors[parentCommit.space] + "stroke-width": 2) - markCommit: (x, y, commit, graphWidth) -> + markCommit: (x, y, commit, graphHeight) -> if commit.id is @options.commit_id r = @raphael - r.path(["M", x, y - 5, "L", x + 4, y - 15, "L", x - 4, y - 15, "Z"]).attr( + r.path(["M", x + 5, y, "L", x + 15, y + 4, "L", x + 15, y - 4, "Z"]).attr( fill: "#000" - "fill-opacity": .7 + "fill-opacity": .5 stroke: "none" ) # Displayed in the center - @scrollLeft = x - graphWidth / 2 + @element.scrollTop(y - graphHeight / 2) Raphael::commitTooltip = (x, y, commit) -> boxWidth = 300 diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb index 4b1abf52..2957adbf 100644 --- a/app/models/network/graph.rb +++ b/app/models/network/graph.rb @@ -40,15 +40,12 @@ module Network def index_commits days = [] @map = {} + @reserved = {} - @commits.reverse.each_with_index do |c,i| + @commits.each_with_index do |c,i| c.time = i days[i] = c.committed_date @map[c.id] = c - end - - @reserved = {} - days.each_index do |i| @reserved[i] = [] end @@ -135,11 +132,7 @@ module Network spaces = [] commit.parents(@map).each do |parent| - range = if commit.time < parent.time then - commit.time..parent.time - else - parent.time..commit.time - end + range = commit.time..parent.time space = if commit.space >= parent.space then find_free_parent_space(range, parent.space, -1, commit.space) @@ -166,7 +159,7 @@ module Network range.each do |i| if i != range.first && i != range.last && - @commits[reversed_index(i)].spaces.include?(overlap_space) then + @commits[i].spaces.include?(overlap_space) then return true; end @@ -184,7 +177,7 @@ module Network return end - time_range = leaves.last.time..leaves.first.time + time_range = leaves.first.time..leaves.last.time space_base = get_space_base(leaves) space = find_free_space(time_range, 2, space_base) leaves.each do |l| @@ -198,17 +191,17 @@ module Network end # and mark it as reserved - min_time = leaves.last.time - leaves.last.parents(@map).each do |parent| - if parent.time < min_time - min_time = parent.time - end + if parent_time.nil? + min_time = leaves.first.time + else + min_time = parent_time + 1 end - if parent_time.nil? - max_time = leaves.first.time - else - max_time = parent_time - 1 + max_time = leaves.last.time + leaves.last.parents(@map).each do |parent| + if max_time < parent.time + max_time = parent.time + end end mark_reserved(min_time..max_time, space) @@ -289,9 +282,5 @@ module Network end refs_cache end - - def reversed_index(index) - -index - 1 - end end end From 916c61fc64292bf4ae2fd84cbbbc86a5afa943bf Mon Sep 17 00:00:00 2001 From: Sato Hiroyuki Date: Thu, 21 Mar 2013 12:34:15 +0000 Subject: [PATCH 5/7] Refactor: clean up code. --- app/assets/javascripts/branch-graph.js.coffee | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee index a3223172..a5cf67c9 100644 --- a/app/assets/javascripts/branch-graph.js.coffee +++ b/app/assets/javascripts/branch-graph.js.coffee @@ -5,6 +5,10 @@ class BranchGraph @mspace = 0 @parents = {} @colors = ["#000"] + @offsetX = 120 + @offsetY = 20 + @unitTime = 20 + @unitSpace = 10 @load() load: -> @@ -47,24 +51,21 @@ class BranchGraph buildGraph: -> graphHeight = $(@element).height() graphWidth = $(@element).width() - ch = Math.max(graphHeight, @mtime * 20 + 100) - cw = Math.max(graphWidth, @mspace * 10 + 260) - r = Raphael(@element.get(0), cw, ch) + ch = Math.max(graphHeight, @unitTime * @mtime + 100) + cw = Math.max(graphWidth, @unitSpace * @mspace + 260) + @r = r = Raphael(@element.get(0), cw, ch) top = r.set() cuday = 0 cumonth = "" - @offsetX = 120 - @offsetY = 20 - barHeight = Math.max(graphHeight, @days.length * 20 + 320) - @scrollLeft = cw - @raphael = r + barHeight = Math.max(graphHeight, @unitTime * @days.length + 320) + r.rect(0, 0, 20, barHeight).attr fill: "#222" r.rect(20, 0, 20, barHeight).attr fill: "#444" for day, mm in @days if cuday isnt day[0] # Dates - r.text(30, @offsetY + mm * 20, day[0]) + r.text(30, @offsetY + @unitTime * mm, day[0]) .attr( font: "12px Monaco, monospace" fill: "#DDD" @@ -73,7 +74,7 @@ class BranchGraph if cumonth isnt day[1] # Months - r.text(10, @offsetY + mm * 20, day[1]) + r.text(10, @offsetY + @unitTime * mm, day[1]) .attr( font: "12px Monaco, monospace" fill: "#EEE" @@ -81,8 +82,8 @@ class BranchGraph cumonth = day[1] for commit in @commits - x = @offsetX + 10 * (@mspace - commit.space) - y = @offsetY + 20 * commit.time + x = @offsetX + @unitSpace * (@mspace - commit.space) + y = @offsetY + @unitTime * commit.time @drawDot(x, y, commit) @@ -126,7 +127,7 @@ class BranchGraph element.scrollTop element.scrollTop() + 50 if event.keyCode is 40 appendLabel: (x, y, refs) -> - r = @raphael + r = @r shortrefs = refs # Truncate if longer than 15 chars shortrefs = shortrefs.substr(0, 15) + "…" if shortrefs.length > 17 @@ -156,7 +157,7 @@ class BranchGraph text.toFront() appendAnchor: (top, commit, x, y) -> - r = @raphael + r = @r options = @options anchor = r.circle(x, y, 10).attr( fill: "#000" @@ -173,19 +174,19 @@ class BranchGraph top.push anchor drawDot: (x, y, commit) -> - r = @raphael + r = @r r.circle(x, y, 3).attr( fill: @colors[commit.space] stroke: "none" ) drawLines: (x, y, commit) -> - r = @raphael + r = @r for parent in commit.parents parentCommit = @preparedCommits[parent[0]] - parentY = @offsetY + 20 * parentCommit.time - parentX1 = @offsetX + 10 * (@mspace - parentCommit.space) - parentX2 = @offsetX + 10 * (@mspace - parent[1]) + parentY = @offsetY + @unitTime * parentCommit.time + parentX1 = @offsetX + @unitSpace * (@mspace - parentCommit.space) + parentX2 = @offsetX + @unitSpace * (@mspace - parent[1]) if parentCommit.space is commit.space and parentCommit.space is parent[1] r.path(["M", x, y, "L", parentX1, parentY]).attr( @@ -235,7 +236,7 @@ class BranchGraph markCommit: (x, y, commit, graphHeight) -> if commit.id is @options.commit_id - r = @raphael + r = @r r.path(["M", x + 5, y, "L", x + 15, y + 4, "L", x + 15, y - 4, "Z"]).attr( fill: "#000" "fill-opacity": .5 From a19e3d898d6bb52867f1356f3410f52fa0d76e98 Mon Sep 17 00:00:00 2001 From: Sato Hiroyuki Date: Wed, 20 Mar 2013 09:19:01 +0000 Subject: [PATCH 6/7] Display icon and commit message on network graph. --- app/assets/javascripts/branch-graph.js.coffee | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee index a5cf67c9..b6ce8ce9 100644 --- a/app/assets/javascripts/branch-graph.js.coffee +++ b/app/assets/javascripts/branch-graph.js.coffee @@ -7,7 +7,7 @@ class BranchGraph @colors = ["#000"] @offsetX = 120 @offsetY = 20 - @unitTime = 20 + @unitTime = 30 @unitSpace = 10 @load() @@ -179,6 +179,15 @@ class BranchGraph fill: @colors[commit.space] stroke: "none" ) + r.rect(@offsetX + @unitSpace * @mspace + 10, y - 10, 20, 20).attr( + fill: "url(#{commit.author.icon})" + stroke: @colors[commit.space] + "stroke-width": 2 + ) + r.text(@offsetX + @unitSpace * @mspace + 35, y, commit.message.split("\n")[0]).attr( + "text-anchor": "start" + font: "14px Monaco, monospace" + ) drawLines: (x, y, commit) -> r = @r From 06c5389780cf5625f68a0efa3d8ef21b496966a7 Mon Sep 17 00:00:00 2001 From: Sato Hiroyuki Date: Thu, 21 Mar 2013 15:24:06 +0000 Subject: [PATCH 7/7] Fix travis failure randomly, because Capybara.default_wait_time is too short. --- spec/spec_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 30518cc2..0f593de8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,6 +16,7 @@ require 'email_spec' require 'sidekiq/testing/inline' require 'capybara/poltergeist' Capybara.javascript_driver = :poltergeist +Capybara.default_wait_time = 10 # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories.