@@ -53,12 +53,12 @@ function disableFieldsThatShouldNotBeSubmitted() {
53
53
$ ( '.version-selectorizor' ) . prop ( 'disabled' , 'disabled' ) ;
54
54
}
55
55
56
- function highlightPactPublicationsWithSameContent ( td ) {
57
- const pactVersionSha = $ ( td ) . data ( 'pact-version-sha' ) ;
58
- $ ( '*[data-pact-version-sha ="' + pactVersionSha + '"]' ) . addClass ( 'bg-info' ) ;
56
+ function highlightPactPublicationsWithSameData ( td , field ) {
57
+ const value = $ ( td ) . data ( field ) ;
58
+ $ ( '*[data-' + field + ' ="' + value + '"]' ) . addClass ( 'bg-info' ) ;
59
59
}
60
60
61
- function unHighlightPactPublicationsWithSameContent ( td , event ) {
61
+ function unHighlightPactPublicationsWithSameData ( td , event , field ) {
62
62
var destinationElement = $ ( event . toElement || event . relatedTarget ) ;
63
63
// Have to use mouseout instead of mouseleave, because the tooltip is a child
64
64
// of the td, and the mouseleave will consider that hovering over the tooltip
@@ -68,8 +68,8 @@ function unHighlightPactPublicationsWithSameContent(td, event) {
68
68
// The tooltip needs to be a child of the td so that we can style the one showing
69
69
// the SHA so that it's wide enough to fit the SHA in.
70
70
if ( ! $ ( td ) . find ( 'a' ) . is ( destinationElement ) ) {
71
- const pactVersionSha = $ ( td ) . data ( 'pact-version-sha' ) ;
72
- $ ( '*[data-pact-version-sha ="' + pactVersionSha + '"]' ) . removeClass ( 'bg-info' ) ;
71
+ const value = $ ( td ) . data ( field ) ;
72
+ $ ( '*[data-' + field + ' ="' + value + '"]' ) . removeClass ( 'bg-info' ) ;
73
73
}
74
74
}
75
75
@@ -90,6 +90,18 @@ $(document).ready(function(){
90
90
91
91
initializeClipper ( '.clippable' ) ;
92
92
93
- $ ( 'td.pact-published' ) . mouseover ( function ( event ) { highlightPactPublicationsWithSameContent ( this ) } ) ;
94
- $ ( 'td.pact-published' ) . mouseout ( function ( event ) { unHighlightPactPublicationsWithSameContent ( this , event ) } ) ;
93
+ $ ( 'td.consumer' ) . mouseover ( function ( event ) { highlightPactPublicationsWithSameData ( this , 'consumer-name' ) } ) ;
94
+ $ ( 'td.consumer' ) . mouseout ( function ( event ) { unHighlightPactPublicationsWithSameData ( this , event , 'consumer-name' ) } ) ;
95
+
96
+ $ ( 'td.consumer-version' ) . mouseover ( function ( event ) { highlightPactPublicationsWithSameData ( this , 'consumer-version-id' ) } ) ;
97
+ $ ( 'td.consumer-version' ) . mouseout ( function ( event ) { unHighlightPactPublicationsWithSameData ( this , event , 'consumer-version-id' ) } ) ;
98
+
99
+ $ ( 'td.pact-published' ) . mouseover ( function ( event ) { highlightPactPublicationsWithSameData ( this , 'pact-version-sha' ) } ) ;
100
+ $ ( 'td.pact-published' ) . mouseout ( function ( event ) { unHighlightPactPublicationsWithSameData ( this , event , 'pact-version-sha' ) } ) ;
101
+
102
+ $ ( 'td.provider' ) . mouseover ( function ( event ) { highlightPactPublicationsWithSameData ( this , 'provider-name' ) } ) ;
103
+ $ ( 'td.provider' ) . mouseout ( function ( event ) { unHighlightPactPublicationsWithSameData ( this , event , 'provider-name' ) } ) ;
104
+
105
+ $ ( 'td.provider-version' ) . mouseover ( function ( event ) { highlightPactPublicationsWithSameData ( this , 'provider-version-id' ) } ) ;
106
+ $ ( 'td.provider-version' ) . mouseout ( function ( event ) { unHighlightPactPublicationsWithSameData ( this , event , 'provider-version-id' ) } ) ;
95
107
} ) ;
0 commit comments