Commit a5fd2d09 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Robert Lyon

Bug 1813987: Make the comment block work

added a js event 'blocksloaded' to signal the blocks were
loaded in the grid and the are available in the DOM

behatnotneeded

Change-Id: I8f54eab5b5b71c712578d8af0f5684497d2f33bc
parent c0f57e7d
......@@ -364,7 +364,7 @@ function toggleDetailsBtn() {
$('#details-btn').off('click');
$('#details-btn').on('click', function(e) {
var detailsActive = 0;
var headers = $('#column-container').find('.block-header');
var headers = $('#main-column-container').find('.block-header');
if (!$('#details-btn').hasClass('active')) {
$('#details-btn').addClass('active');
......@@ -396,7 +396,7 @@ $(document).on('pageupdated', function(e, data) {
}
});
jQuery(function($) {
jQuery(window).on('blocksloaded', {}, function() {
toggleDetailsBtn();
......
......@@ -11,7 +11,7 @@
{$feedback->pagination|safe}
{if $feedback->pagination_js}
<script>
{$feedback->pagination_js|safe}
paginator = {$feedback->pagination_js|safe};
</script>
{/if}
</p>
......
......@@ -381,6 +381,7 @@ $(function () {
null, null, null, null, null,
blockid);
});
jQuery(document).trigger('blocksloaded');
});
EOF;
}
......@@ -410,7 +411,7 @@ jQuery(function () {
paginator = {$feedback->pagination_js}
});
jQuery(function($) {
jQuery(window).on('blocksloaded', {}, function() {
var deletebutton = $('#configureblock').find('.deletebutton');
deletebutton.on('click', function(e) {
......@@ -484,7 +485,7 @@ if ($modal = param_integer('modal', null)) {
if ($block = param_integer('block', null)) {
$javascript .= <<<EOF
jQuery(function($) {
jQuery(window).on('blocksloaded', {}, function() {
$('#main-column-container').append('<a id="tmp_modal_link" class="modal_link" href="#" data-toggle="modal-docked" data-target="#configureblock" data-blockid="' + $block + '" data-artefactid="' + $artefact + '" ></a>');
$('a#tmp_modal_link').off('click');
$('a#tmp_modal_link').on('click', function(e) {
......@@ -497,7 +498,7 @@ EOF;
}
else {
$javascript .= <<<EOF
jQuery(function($) {
jQuery(window).on('blocksloaded', {}, function() {
$('#main-column-container').append('<a id="tmp_modal_link" class="modal_link" href="#" data-toggle="modal-docked" data-target="#configureblock" data-artefactid="' + $artefact + '" ></a>');
$('a#tmp_modal_link').off('click');
$('a#tmp_modal_link').on('click', function(e) {
......@@ -512,8 +513,8 @@ EOF;
// Load the page with details content (block headers) displaying according to user preferences.
if ($showdetails = get_account_preference($USER->get('id'), 'view_details_active')) {
$javascript .= <<<EOF
jQuery(function($) {
var headers = $('#column-container').find('.block-header');
jQuery(window).on('blocksloaded', {}, function() {
var headers = $('#main-column-container').find('.block-header');
$('#details-btn').addClass('active');
headers.removeClass('d-none');
});
......
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