Commit 8d12f987 authored by Lisa Seeto's avatar Lisa Seeto Committed by Robert Lyon
Browse files

Bug 1873121: HTML / PDF export of Gallery block in slideshow mode is broken



- added carouselHeight() in to viewcontent.tpl to fix display for export preview modal
- added carouselHeight() to export view.tpl to fix display for html export
- added in script tags to export header.tpl to include neccessary funcs
- added code changes to raw, custom theme.js
- added window level scope to carouselHeight ()

Change-Id: I93c44b1b356434eac2d4b8a062166528eaa07999
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
(cherry picked from commit 5e5cf6c1)
parent 01eed8e4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ class PluginExportHtml extends PluginExport {
     * These javascript files will be included in index.html via the
     * export/html/templates/header.tpl
     */
    private $scripts = array('jquery', 'bootstrap.min', 'dock', 'modal', 'lodash', 'gridstack', 'gridlayout');
    private $scripts = array('jquery', 'bootstrap.min', 'dock', 'modal', 'lodash', 'gridstack', 'gridlayout', 'masonry.min', 'select2.full', 'theme');

    /**
    * constructor.  overrides the parent class
@@ -879,6 +879,8 @@ private function get_folder_modals(&$idarray, BlockInstance $bi) {
        $directoriestocopy[get_config('docroot') . 'js/lodash/lodash.js'] = $jsdir . 'lodash.js';
        $directoriestocopy[get_config('docroot') . 'js/gridstack/gridstack.js'] = $jsdir . 'gridstack.js';
        $directoriestocopy[get_config('docroot') . 'js/gridlayout.js'] = $jsdir . 'gridlayout.js';
        $directoriestocopy[get_config('docroot') . 'js/masonry/masonry.min.js'] = $jsdir . 'masonry.min.js';
        $directoriestocopy[get_config('docroot') . 'js/select2/select2.full.js'] = $jsdir . 'select2.full.js';

        foreach ($this->pluginstaticdirs as $dir) {
            $destinationdir = str_replace('export/html/', '', $dir);
+6 −5
Original line number Diff line number Diff line
/*jslint browser: true, nomen: true,  white: true */
/* global jQuery, $ */

jQuery(function($) {
"use strict";

@@ -89,7 +90,7 @@ jQuery(function($) {
    /*
     * Calculate carousel(image gallery) height
     */
    function carouselHeight() {
     window.carouselHeight = function () {
        var carousel = $('.carousel'),
            i, j,
            carouselItem,
@@ -255,10 +256,10 @@ jQuery(function($) {
        responsiveObjectVideo()
    });

    $(window).on('load', function() {
    if (document.readyState === "complete") {
      carouselHeight();
      initUserThumbnailMasonry();
    });
    }

    $('.block.collapse').on('shown.bs.collapse', function() {
        carouselHeight();
+10 −13
Original line number Diff line number Diff line
/*jslint browser: true, nomen: true,  white: true */
/* global jQuery, $ */

jQuery(function($) {
"use strict";

@@ -48,7 +49,8 @@ jQuery(function($) {
        if ($('.site-messages').length === 0) {
            $('.header').addClass('no-site-messages');
            $('.main-nav').addClass('no-site-messages');
        } else if ($('.site-messages') !== undefined) {
        }
        else if ($('.site-messages') !== undefined) {
            message = $('.site-messages').find('.site-message');
            $('.header').addClass('message-count-'+ message.length);
            $('.header').removeClass('no-site-messages');
@@ -88,7 +90,7 @@ jQuery(function($) {
    /*
     * Calculate carousel(image gallery) height
     */
    function carouselHeight() {
    window.carouselHeight = function () {
        var carousel = $('.carousel'),
            i, j,
            carouselItem,
@@ -140,7 +142,8 @@ jQuery(function($) {
        context.find('.js-with-dropdown input').attr('placeholder', val);
        if (context.find('.js-dropdown-context').length > 0) {
            context.find('.js-dropdown-context').html('(' + val + ')');
        } else {
        }
        else {
            context.find('.js-with-dropdown label').append('<em class="js-dropdown-context text-midtone text-small">('+ val + ')</em>');
        }
    }
@@ -214,12 +217,6 @@ jQuery(function($) {
      carouselHeight();
      initUserThumbnailMasonry();
    }
    else {
        $(window).on('load', function() {
            carouselHeight();
            initUserThumbnailMasonry();
        });
    }

    $('.block.collapse').on('shown.bs.collapse', function() {
        carouselHeight();
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@ $(function () {
    var blocks = {json_encode arg=$blocks};
    loadGrid(grid, blocks);
    jQuery(document).trigger('blocksloaded');
    // Prevent image gallery images from overlapping
    carouselHeight();
});
</script>
{/if}
+17 −14
Original line number Diff line number Diff line
{if $newlayout}
<script>
$(function () {
    {if $newlayout}
        var options = {
            verticalMargin: 10,
            float: true,
@@ -14,9 +14,12 @@ $(function () {
        var blocks = {json_encode arg=$blocks};
        loadGrid(grid, blocks);
        jQuery(document).trigger('blocksloaded');
    {/if}
    // Prevent Image Gallery block images from overlapping
    carouselHeight();
});
</script>
{/if}

<h2>
    {$viewtitle}
    {if $ownername}