From 8e21e8864795ef5b952d2de02f2d36aa15e92b83 Mon Sep 17 00:00:00 2001 From: jeffersoncasimir <15801528+jeffersoncasimir@users.noreply.github.com> Date: Tue, 23 Apr 2024 12:18:28 -0400 Subject: [PATCH] [behavioural_qc ] Auto-open behavioural panel with query parameter (#9183) This adds the query parameter showFeedback=true to trigger auto-opening the feedback panel on-load. Fixes #8056. --- .../jsx/tabs_content/behaviouralFeedback.js | 6 +++++ .../js/bvl_feedback_panel_jquery.js | 25 +++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/modules/behavioural_qc/jsx/tabs_content/behaviouralFeedback.js b/modules/behavioural_qc/jsx/tabs_content/behaviouralFeedback.js index ff9523d3e4b..5ce9a202c6a 100644 --- a/modules/behavioural_qc/jsx/tabs_content/behaviouralFeedback.js +++ b/modules/behavioural_qc/jsx/tabs_content/behaviouralFeedback.js @@ -119,6 +119,8 @@ class BehaviouralFeedback extends Component { rowData['sessionID'] + '&commentID=' + rowData['commentID']; + // Open feedback panel + bvlLink += '&showFeedback=true'; bvlLevel ='Instrument : ' + rowData['Instrument']; } else if (rowData['Visit']) { bvlLink = this.props.baseURL + @@ -127,10 +129,14 @@ class BehaviouralFeedback extends Component { rowData['DCCID'] + '&sessionID=' + rowData['sessionID']; + // Open feedback panel + bvlLink += '&showFeedback=true'; bvlLevel ='Visit : ' + rowData['Visit']; } else { bvlLink = this.props.baseURL + '/' + rowData['DCCID']; + // Open feedback panel + bvlLink += '/?showFeedback=true'; bvlLevel ='Profile : ' + rowData['PSCID']; } reactElement = ( diff --git a/modules/bvl_feedback/js/bvl_feedback_panel_jquery.js b/modules/bvl_feedback/js/bvl_feedback_panel_jquery.js index 25973747cda..ae29b2991ab 100644 --- a/modules/bvl_feedback/js/bvl_feedback_panel_jquery.js +++ b/modules/bvl_feedback/js/bvl_feedback_panel_jquery.js @@ -1,4 +1,14 @@ +function toggleBVLMenu() { + $("#bvl_feedback_menu").toggleClass("active_panel"); + $("#bvl_panel_wrapper").toggleClass("bvl_panel"); + // We check if a sidebar exists on the page and toggle it if such. + if ($("#page_wrapper_sidebar").length){ + $("#sidebar-wrapper").toggle("#sidebar-wrapper hide_sidebar"); + $("#page_wrapper_sidebar").toggleClass("wrapper"); + } + $('.dynamictable').DynamicTable(); +} /** * Created by evanmcilroy on 15-06-09. */ @@ -7,17 +17,12 @@ $(document).ready(function() { var sessionID = $('meta[itemprop="sessionID"]').attr("context"); var commentID = $('meta[itemprop="commentID"]').attr("context"); - $('.navbar-toggle').on('click',function(event){ - $("#bvl_feedback_menu").toggleClass("active_panel"); - $("#bvl_panel_wrapper").toggleClass("bvl_panel"); + $('.navbar-toggle').on('click', toggleBVLMenu); - //We check if a sidebar exists on the page and toggle it if such. - if ($("#page_wrapper_sidebar").length){ - $("#sidebar-wrapper").toggle("#sidebar-wrapper hide_sidebar"); - $("#page_wrapper_sidebar").toggleClass("wrapper"); - } - $('.dynamictable').DynamicTable(); - }); + const urlParams = new URLSearchParams(window.location.search); + if (urlParams.get('showFeedback') === 'true') { + toggleBVLMenu(); + } }); // end of document