aboutsummaryrefslogtreecommitdiffstats
path: root/html/js/git-deps-graph.coffee
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2015-01-12 02:02:31 +0000
committerAdam Spiers <git@adamspiers.org>2015-01-12 02:04:56 +0000
commit5b34b9e246b32a9b8ce1c74a372ec1eb58acdd60 (patch)
treec2ba09e78f5f0000a339a9d702a219a009c44f1a /html/js/git-deps-graph.coffee
parent383ed92b11cc709c1b21f354e2a7b7f966a2763d (diff)
downloadgit-deps-5b34b9e246b32a9b8ce1c74a372ec1eb58acdd60.tar.gz
extract explore_node() for reuse when clicking plus icon
Diffstat (limited to 'html/js/git-deps-graph.coffee')
-rw-r--r--html/js/git-deps-graph.coffee12
1 files changed, 7 insertions, 5 deletions
diff --git a/html/js/git-deps-graph.coffee b/html/js/git-deps-graph.coffee
index 1b17ba5..6666973 100644
--- a/html/js/git-deps-graph.coffee
+++ b/html/js/git-deps-graph.coffee
@@ -250,6 +250,12 @@ define_arrow_markers = (fg) ->
.attr("d", "M0,-5L10,0L0,5")
.attr "fill", "#000"
+explore_node = (d) ->
+ if d.explored
+ gdn.warn "Commit #{d.name} already explored"
+ else
+ add_commitish d.sha1
+
draw_nodes = (fg, node) ->
# Initialize tooltip
tip = d3.tip().attr("class", "d3-tip").html(tip_html)
@@ -263,11 +269,7 @@ draw_nodes = (fg, node) ->
update_rect_explored()
- rect.on "dblclick", (d) ->
- if d.explored
- gdn.warn "Commit #{d.name} already explored"
- else
- add_commitish d.sha1
+ rect.on "dblclick", (d) -> explore_node d
label = node.append("text").text((d) ->
d.name