Commit a6af8123 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1894026: fetch js from correct folder in html exports

behatnotneeded

Change-Id: I6a58c9c9a1f314ae17b838aa0ca72f201caec351
parent 1fe25a73
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -320,7 +320,21 @@ class PluginExportHtml extends PluginExport {
        $smarty->assign('export_time', $this->exporttime);
        $smarty->assign('sitename', get_config('sitename'));
        $smarty->assign('stylesheets', $stylesheets);
        $smarty->assign('scripts', $this->scripts);
        $smarty->assign('WWWROOT', get_config('wwwroot'));
        $htmldir = ($this->exportingoneview ? '' : 'HTML/');
        $scripts = [];
        foreach($this->scripts as $i => $script) {
            // theme should be in theme folder use,
            // the rest of the scripts don't depend on the theme
            if ($script == 'theme') {
                $scripts[$i] = $rootpath . $htmldir . $this->theme_path('js/') .  $script . '.js';
            }
            else {
                $scripts[$i] = $rootpath . $htmldir . 'static/theme/raw/static/js/' . $script . '.js';
            }
        }
        $smarty->assign('scripts', $scripts);

        if ($this->exportingoneview) {
            $smarty->assign('scriptspath', $rootpath . $this->theme_path('js/'));
        }
+6 −1
Original line number Diff line number Diff line
@@ -6,8 +6,13 @@
{foreach from=$stylesheets item=sheet}
        <link rel="stylesheet" type="text/css" href="{$rootpath}{if !$exportingoneview}HTML/{/if}static/{$sheet}">
{/foreach}
        <script>
        var config = {literal}{{/literal}
            'wwwroot': '{$WWWROOT}',
        {literal}}{/literal};
        </script>
{foreach from=$scripts item=script}
        <script type='text/javascript' src='{$scriptspath}{$script}.js'></script>
        <script type='text/javascript' src='{$script}'></script>
{/foreach}
    </head>
    <body>