Commit 188e6a7a3fba5ca3705d6e0c5ab09b3cf89700a3
Exists in
master
and in
4 other branches
Merge pull request #3369 from hiroponz/display-note-count
Display note count on network graph.
Showing
3 changed files
with
19 additions
and
16 deletions
Show diff stats
app/assets/javascripts/branch-graph.js.coffee
| ... | ... | @@ -131,7 +131,7 @@ class BranchGraph |
| 131 | 131 | shortrefs = refs |
| 132 | 132 | # Truncate if longer than 15 chars |
| 133 | 133 | shortrefs = shortrefs.substr(0, 15) + "…" if shortrefs.length > 17 |
| 134 | - text = r.text(x + 8, y, shortrefs).attr( | |
| 134 | + text = r.text(x + 4, y, shortrefs).attr( | |
| 135 | 135 | "text-anchor": "start" |
| 136 | 136 | font: "10px Monaco, monospace" |
| 137 | 137 | fill: "#FFF" |
| ... | ... | @@ -139,7 +139,7 @@ class BranchGraph |
| 139 | 139 | ) |
| 140 | 140 | textbox = text.getBBox() |
| 141 | 141 | # Create rectangle based on the size of the textbox |
| 142 | - rect = r.rect(x, y - 7, textbox.width + 15, textbox.height + 5, 4).attr( | |
| 142 | + rect = r.rect(x, y - 7, textbox.width + 5, textbox.height + 5, 4).attr( | |
| 143 | 143 | fill: "#000" |
| 144 | 144 | "fill-opacity": .5 |
| 145 | 145 | stroke: "none" |
| ... | ... | @@ -206,22 +206,19 @@ class BranchGraph |
| 206 | 206 | |
| 207 | 207 | # Build line shape |
| 208 | 208 | if parent[1] is commit.space |
| 209 | - d1 = [0, 5] | |
| 210 | - d2 = [0, 10] | |
| 211 | - arrow = "l-2,5,4,0,-2,-5" | |
| 209 | + offset = [0, 5] | |
| 210 | + arrow = "l-2,5,4,0,-2,-5,0,5" | |
| 212 | 211 | |
| 213 | 212 | else if parent[1] < commit.space |
| 214 | - d1 = [3, 3] | |
| 215 | - d2 = [7, 5] | |
| 216 | - arrow = "l5,0,-2,4,-3,-4" | |
| 213 | + offset = [3, 3] | |
| 214 | + arrow = "l5,0,-2,4,-3,-4,4,2" | |
| 217 | 215 | |
| 218 | 216 | else |
| 219 | - d1 = [-3, 3] | |
| 220 | - d2 = [-7, 5] | |
| 221 | - arrow = "l-5,0,2,4,3,-4" | |
| 217 | + offset = [-3, 3] | |
| 218 | + arrow = "l-5,0,2,4,3,-4,-4,2" | |
| 222 | 219 | |
| 223 | 220 | # Start point |
| 224 | - route = ["M", x + d1[0], y + d1[1]] | |
| 221 | + route = ["M", x + offset[0], y + offset[1]] | |
| 225 | 222 | |
| 226 | 223 | # Add arrow if not first parent |
| 227 | 224 | if i > 0 |
| ... | ... | @@ -230,7 +227,6 @@ class BranchGraph |
| 230 | 227 | # Circumvent if overlap |
| 231 | 228 | if commit.space isnt parentCommit.space or commit.space isnt parent[1] |
| 232 | 229 | route.push( |
| 233 | - "L", x + d2[0], y + d2[1], | |
| 234 | 230 | "L", parentX2, y + 10, |
| 235 | 231 | "L", parentX2, parentY - 5, |
| 236 | 232 | ) | ... | ... |
app/helpers/graph_helper.rb
| 1 | 1 | module GraphHelper |
| 2 | - def join_with_space(ary) | |
| 3 | - ary.collect{|r|r.name}.join(" ") unless ary.nil? | |
| 2 | + def get_refs(commit) | |
| 3 | + refs = "" | |
| 4 | + refs += commit.refs.collect{|r|r.name}.join(" ") if commit.refs | |
| 5 | + | |
| 6 | + # append note count | |
| 7 | + notes = @project.notes.for_commit_id(commit.id) | |
| 8 | + refs += "[#{notes.count}]" if notes.any? | |
| 9 | + | |
| 10 | + refs | |
| 4 | 11 | end |
| 5 | 12 | |
| 6 | 13 | def parents_zip_spaces(parents, parent_spaces) | ... | ... |