@@ -19,11 +19,11 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
19
19
rating : '=' ,
20
20
graphState : '='
21
21
} ,
22
- controller : [ '$scope' , '$state' , '$window' , ' CONSTANTS', HistoryGraphController ]
22
+ controller : [ '$scope' , '$state' , 'CONSTANTS' , HistoryGraphController ]
23
23
}
24
24
}
25
25
26
- function HistoryGraphController ( $scope , $state , $window , CONSTANTS ) {
26
+ function HistoryGraphController ( $scope , $state , CONSTANTS ) {
27
27
$scope . colors = [
28
28
// grey
29
29
{
@@ -275,14 +275,13 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
275
275
$scope . historyRating = d . newRating
276
276
$scope . historyDate = moment ( d . ratingDate ) . format ( 'YYYY-MM-DD' )
277
277
$scope . historyChallenge = d . challengeName
278
- $scope . $digest ( )
279
278
$ ( '#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' )
282
281
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 ' )
284
283
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 ' )
286
285
} )
287
286
d3 . select ( '#chart-tooltip' )
288
287
. style ( 'left' , ( d3 . event . pageX - 5 ) + 'px' )
@@ -298,21 +297,20 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
298
297
d3 . select ( '#chart-tooltip .challenge-date' ) . text ( moment ( d . ratingDate ) . format ( 'MMM DD, YYYY' ) )
299
298
d3 . select ( '#chart-tooltip .tooltip-rating' ) . text ( $scope . historyRating )
300
299
d3 . select ( '#chart-tooltip .tooltip-rating' ) . style ( 'background' , ratingToColor ( $scope . colors , $scope . historyRating ) )
301
-
300
+ $scope . $digest ( )
302
301
} )
303
302
. on ( 'mouseout' , function ( d ) {
304
303
$scope . historyRating = undefined
305
- $scope . $digest ( )
306
304
$ ( '#chart-tooltip' ) . off ( 'click' )
305
+ $scope . $digest ( )
307
306
} )
308
307
309
308
d3 . select ( 'body' ) . on ( 'click' , function ( ) {
310
309
if ( ( d3 . event . target . classList [ 0 ] != 'tooltip-target' ) && ! $ ( '#chart-tooltip .tooltip-container' ) . hasClass ( 'tooltip-hide' ) &&
311
310
( d3 . event . target . classList [ 0 ] != 'tooltip-content-container' ) && ( d3 . event . target . classList [ 0 ] != 'tooltip-container' ) &&
312
311
( d3 . event . target . classList [ 0 ] != 'tooltip-body' ) && ( d3 . event . target . classList [ 0 ] != 'Tooltip' ) &&
313
312
( 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' )
316
314
}
317
315
} )
318
316
0 commit comments