Skip to content

Commit

Permalink
Deactivate the active node and its popover when the user clicks "View"
Browse files Browse the repository at this point in the history
in the prov chart popover.

Closes #398
  • Loading branch information
laurenwalker committed Dec 1, 2017
1 parent e86360f commit 5a2bee7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions metacatui/src/main/webapp/js/views/ProvChartView.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,13 +591,21 @@ define(['jquery', 'underscore', 'backbone', "views/CitationView", "views/ProvSta
if(isCollapsed) $(nodeB).first().addClass("collapsed");
},

/*
* Will show a preview of the data for the currently active node
*/
previewData: function(e){
//Don't go anywhere yet...
e.preventDefault();

if(this.parentView){
if(this.parentView.previewData(e))
return;
//If this prov chart has a parent view with a previewData function, then execute that
if(this.parentView && this.parentView.previewData && this.parentView.previewData(e)){

//Trigger a click on the active node to deactivate it
this.$(".node.active").click();

//Exit
return;
}

//Get the target of the click
Expand All @@ -607,7 +615,11 @@ define(['jquery', 'underscore', 'backbone', "views/CitationView", "views/ProvSta
if(button.length < 1)
button = $(button).parents("[href]");

window.location = $(button).attr("href"); //navigate to the link href
//Trigger a click on the active node to deactivate it
this.$(".node.active").click();

//navigate to the link href
window.location = $(button).attr("href");
},

onClose: function() {
Expand Down

0 comments on commit 5a2bee7

Please sign in to comment.