Skip to content

Commit

Permalink
#2 workaround for node id
Browse files Browse the repository at this point in the history
  • Loading branch information
p-a-s-c-a-l committed Nov 7, 2018
1 parent 355cea0 commit abd030c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/scripts/connectors/nodeConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ window.Drupal.behaviors.myBehavior = {
$(window, context).once('scenarioAnalysisIFrameBehavior').each(function () {
// now using the csisHelpers Module (https://github.com/clarity-h2020/csis-helpers-module)
// to get node and group id!
var nodeId = drupalSettings.csisHelpers.entityinfo.step;
var groupId = drupalSettings.csisHelpers.entityinfo.study;

// FIXME: this does not work if the iframe is embedded in a separate node that is then referenced
// from the node containg the actual data!
var nodeId = drupalSettings.csisHelpers.entityinfo.step;

// ugly workaround parsing the node id from URL study/$1/step/$2
nodeId = window.location.pathname.split('/')[4];

console.log('groupId = ' + groupId + ', nodeId = ' + nodeId);
var connectCount = 0;
Expand All @@ -25,7 +31,6 @@ window.Drupal.behaviors.myBehavior = {
// FIXME: for some unknown reason, onConnect is called if no child frame has actively connected
// by invoking seamless.connect() resulting in the onConnect function called twice!
if (connectCount === 1) {
//var nodeId = window.location.pathname.split('/').pop();
scenarioAnalysisApp.send({
nodeId: nodeId,
groupId: groupId
Expand Down

0 comments on commit abd030c

Please sign in to comment.