summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-30 15:10:26 -0700
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-30 15:10:26 -0700
commit188e6a7a3fba5ca3705d6e0c5ab09b3cf89700a3 (patch)
tree9d523d1ecf8340cb5e840bac26c33e70b2dd7e32 /app
parentc918000bc25f2d9905d22ed80940a6b4b61426af (diff)
parentb49c1cb161e4d97c4ee33ae45a48e948f1097e60 (diff)
downloadgitlab-ce-188e6a7a3fba5ca3705d6e0c5ab09b3cf89700a3.tar.gz
Merge pull request #3369 from hiroponz/display-note-count
Display note count on network graph.
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/branch-graph.js.coffee22
-rw-r--r--app/helpers/graph_helper.rb11
-rw-r--r--app/views/graph/show.json.erb2
3 files changed, 19 insertions, 16 deletions
diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee
index 796bebe219a..2a668de278a 100644
--- a/app/assets/javascripts/branch-graph.js.coffee
+++ b/app/assets/javascripts/branch-graph.js.coffee
@@ -131,7 +131,7 @@ class BranchGraph
shortrefs = refs
# Truncate if longer than 15 chars
shortrefs = shortrefs.substr(0, 15) + "…" if shortrefs.length > 17
- text = r.text(x + 8, y, shortrefs).attr(
+ text = r.text(x + 4, y, shortrefs).attr(
"text-anchor": "start"
font: "10px Monaco, monospace"
fill: "#FFF"
@@ -139,7 +139,7 @@ class BranchGraph
)
textbox = text.getBBox()
# Create rectangle based on the size of the textbox
- rect = r.rect(x, y - 7, textbox.width + 15, textbox.height + 5, 4).attr(
+ rect = r.rect(x, y - 7, textbox.width + 5, textbox.height + 5, 4).attr(
fill: "#000"
"fill-opacity": .5
stroke: "none"
@@ -206,22 +206,19 @@ class BranchGraph
# Build line shape
if parent[1] is commit.space
- d1 = [0, 5]
- d2 = [0, 10]
- arrow = "l-2,5,4,0,-2,-5"
+ offset = [0, 5]
+ arrow = "l-2,5,4,0,-2,-5,0,5"
else if parent[1] < commit.space
- d1 = [3, 3]
- d2 = [7, 5]
- arrow = "l5,0,-2,4,-3,-4"
+ offset = [3, 3]
+ arrow = "l5,0,-2,4,-3,-4,4,2"
else
- d1 = [-3, 3]
- d2 = [-7, 5]
- arrow = "l-5,0,2,4,3,-4"
+ offset = [-3, 3]
+ arrow = "l-5,0,2,4,3,-4,-4,2"
# Start point
- route = ["M", x + d1[0], y + d1[1]]
+ route = ["M", x + offset[0], y + offset[1]]
# Add arrow if not first parent
if i > 0
@@ -230,7 +227,6 @@ class BranchGraph
# Circumvent if overlap
if commit.space isnt parentCommit.space or commit.space isnt parent[1]
route.push(
- "L", x + d2[0], y + d2[1],
"L", parentX2, y + 10,
"L", parentX2, parentY - 5,
)
diff --git a/app/helpers/graph_helper.rb b/app/helpers/graph_helper.rb
index 369330151f4..ca7d823a45a 100644
--- a/app/helpers/graph_helper.rb
+++ b/app/helpers/graph_helper.rb
@@ -1,6 +1,13 @@
module GraphHelper
- def join_with_space(ary)
- ary.collect{|r|r.name}.join(" ") unless ary.nil?
+ def get_refs(commit)
+ refs = ""
+ refs += commit.refs.collect{|r|r.name}.join(" ") if commit.refs
+
+ # append note count
+ notes = @project.notes.for_commit_id(commit.id)
+ refs += "[#{notes.count}]" if notes.any?
+
+ refs
end
def parents_zip_spaces(parents, parent_spaces)
diff --git a/app/views/graph/show.json.erb b/app/views/graph/show.json.erb
index d0a0709ac47..529d584971f 100644
--- a/app/views/graph/show.json.erb
+++ b/app/views/graph/show.json.erb
@@ -13,7 +13,7 @@
},
time: c.time,
space: c.spaces.first,
- refs: join_with_space(c.refs),
+ refs: get_refs(c),
id: c.sha,
date: c.date,
message: c.message,