Commit a4577946 authored by Robert Lyon's avatar Robert Lyon

Bug 1690232: Comments link on retractable block failing to open modal

Actually the modal is opening and closing in the same instant.

This is caused by some code dealing with collapsible blocks making
sure modals are closed if outside certain rules.

This change checks what modal we are wanting and closing all but the
one are targeting when clicking the 'comments' link

behatnotneeded

Sponsored by SWITCH

Change-Id: Idb5165bdc8349f77286aa776ff75d152968aefda
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 5ce66781)
(cherry picked from commit b2858fcf)
parent 056ee10c
...@@ -218,8 +218,12 @@ jQuery(function($) { ...@@ -218,8 +218,12 @@ jQuery(function($) {
$('.block.collapse').on('click',function(e) { $('.block.collapse').on('click',function(e) {
var dialog = $('.modal-dialog'), var dialog = $('.modal-dialog'),
dialogParent = $(e.target).closest('.modal-dialog').length; dialogParent = $(e.target).closest('.modal-dialog').length;
// If we have a link to a comments dialog within a collapsible block
if(e.target !== dialog && !dialogParent){ // We need to close all of them except for the one we just
// clicked for
var collapseModalTarget = $(e.target).data('target');
var wantedDialog = $(collapseModalTarget);
if (e.target !== dialog && !wantedDialog.length && !dialogParent) {
$(this).find('button.close').trigger('click'); $(this).find('button.close').trigger('click');
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment