From 5aa290642a8e45e21edd00b8ef080a3078db874b Mon Sep 17 00:00:00 2001 From: Lukas Domnick Date: Sat, 8 Jun 2013 08:49:03 +0200 Subject: [PATCH] Click handler for the commit dots --- src/GitList/Controller/NetworkController.php | 4 ++++ web/js/networkGraph.js | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/GitList/Controller/NetworkController.php b/src/GitList/Controller/NetworkController.php index d50e728..8cd5711 100644 --- a/src/GitList/Controller/NetworkController.php +++ b/src/GitList/Controller/NetworkController.php @@ -43,11 +43,15 @@ class NetworkController implements ControllerProviderInterface $jsonFormattedCommits = array(); foreach( $commits as $commit ) { + $detailsUrl = $app['url_generator']->generate('commit', array( 'repo' => $repo, + 'commit'=>$commit->getHash())); + $jsonFormattedCommits[$commit->getHash()] = array( 'hash' => $commit->getHash(), 'parentsHash' => $commit->getParentsHash(), 'date' => $commit->getDate()->format('U'), 'message' => htmlentities( $commit->getMessage() ), + 'details' => $detailsUrl, 'author' => array( 'name' => $commit->getAuthor()->getName(), 'email' => $commit->getAuthor()->getEmail(), diff --git a/web/js/networkGraph.js b/web/js/networkGraph.js index 487b470..58606b6 100644 --- a/web/js/networkGraph.js +++ b/web/js/networkGraph.js @@ -465,7 +465,8 @@ }) .data('commit', commit) .mouseover( handleCommitMouseover ) - .mouseout( handleCommitMouseout); + .mouseout( handleCommitMouseout ) + .click( handleCommitClick ); $.each( commit.children, function ( idx, thisChild ) { @@ -539,6 +540,10 @@ detailOverlay.hide(); } + function handleCommitClick( evt ) { + window.open( this.data('commit').details ); + } + function getXPositionForColumnNumber( columnNumber ) { // we want the column's center point return ( paper.width - ( columnNumber * cfg.columnWidth ) + (cfg.columnWidth / 2 ));