@@ -19,11 +19,11 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
1919 rating : '=' ,
2020 graphState : '='
2121 } ,
22- controller : [ '$scope' , '$state' , '$window' , ' CONSTANTS', HistoryGraphController ]
22+ controller : [ '$scope' , '$state' , 'CONSTANTS' , HistoryGraphController ]
2323 }
2424 }
2525
26- function HistoryGraphController ( $scope , $state , $window , CONSTANTS ) {
26+ function HistoryGraphController ( $scope , $state , CONSTANTS ) {
2727 $scope . colors = [
2828 // grey
2929 {
@@ -275,14 +275,13 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
275275 $scope . historyRating = d . newRating
276276 $scope . historyDate = moment ( d . ratingDate ) . format ( 'YYYY-MM-DD' )
277277 $scope . historyChallenge = d . challengeName
278- $scope . $digest ( )
279278 $ ( '#chart-tooltip .tooltip-container' ) . on ( 'click' , function ( ) {
280- if ( $state . params && $state . params . track === 'DEVELOP' )
281- $window . open ( CONSTANTS . CHALLENGE_DETAIL_URL + d . challengeId + '/?type=develop' , '_blank ')
279+ if ( $state . params && $state . params . track === 'DEVELOP' , '_self' )
280+ location . href = ( CONSTANTS . CHALLENGE_DETAIL_URL + d . challengeId + '/?type=develop' )
282281 else if ( $state . params && $state . params . subTrack === 'SRM' )
283- $window . open ( CONSTANTS . SRM_DETAIL_URL + d . challengeId , '_blank ' )
282+ location . href = ( CONSTANTS . SRM_DETAIL_URL + d . challengeId , '_self ' )
284283 else if ( $state . params && $state . params . subTrack === 'MARATHON_MATCH' )
285- $window . open ( CONSTANTS . MARATHON_DETAIL_URL + d . challengeId , '_blank ' )
284+ location . href = ( CONSTANTS . MARATHON_DETAIL_URL + d . challengeId , '_self ' )
286285 } )
287286 d3 . select ( '#chart-tooltip' )
288287 . style ( 'left' , ( d3 . event . pageX - 5 ) + 'px' )
@@ -298,21 +297,20 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
298297 d3 . select ( '#chart-tooltip .challenge-date' ) . text ( moment ( d . ratingDate ) . format ( 'MMM DD, YYYY' ) )
299298 d3 . select ( '#chart-tooltip .tooltip-rating' ) . text ( $scope . historyRating )
300299 d3 . select ( '#chart-tooltip .tooltip-rating' ) . style ( 'background' , ratingToColor ( $scope . colors , $scope . historyRating ) )
301-
300+ $scope . $digest ( )
302301 } )
303302 . on ( 'mouseout' , function ( d ) {
304303 $scope . historyRating = undefined
305- $scope . $digest ( )
306304 $ ( '#chart-tooltip' ) . off ( 'click' )
305+ $scope . $digest ( )
307306 } )
308307
309308 d3 . select ( 'body' ) . on ( 'click' , function ( ) {
310309 if ( ( d3 . event . target . classList [ 0 ] != 'tooltip-target' ) && ! $ ( '#chart-tooltip .tooltip-container' ) . hasClass ( 'tooltip-hide' ) &&
311310 ( d3 . event . target . classList [ 0 ] != 'tooltip-content-container' ) && ( d3 . event . target . classList [ 0 ] != 'tooltip-container' ) &&
312311 ( d3 . event . target . classList [ 0 ] != 'tooltip-body' ) && ( d3 . event . target . classList [ 0 ] != 'Tooltip' ) &&
313312 ( d3 . event . target . tagName . toLowerCase ( ) != 'circle' ) && ! ( d3 . event . target . tagName . toLowerCase ( ) == 'rect' && d3 . event . target . classList [ 0 ] == 'hover' ) ) {
314- $ ( '#chart-tooltip .tooltip-container' ) . addClass ( 'tooltip-hide' )
315- $ ( '#chart-tooltip .tooltip-container' ) . css ( 'opacity' , 0 )
313+ $ ( '#chart-tooltip .tooltip-target' ) . trigger ( 'click' )
316314 }
317315 } )
318316
0 commit comments