← Back to team overview

mahara-contributors team mailing list archive

[Bug 1912709] Re: Having 'js' folder in theme breaks HTML exports

 

Hi Kristina,

Not sure I'm understanding what you mean exactly - will just provide
some more context and a question.

The customisation we made to Mahara is only a custom theme, which is
supported by Mahara. The custom theme has 'raw' set as its parent. We
followed the structure of the raw theme, essentially, which is why we
put js files into a "js" folder directly in the custom theme's
directory. Are we not to put custom js files in this location -
`<siteroot>/mahara/htdocs/theme/customtheme/js/theme.js`?

As for your second question, do you mean adding our js (e.g. custom.js)
to the js folder in the raw theme directly?

The main issue, if it is considered one, is that having a custom theme
with a "js" folder breaks the HTML exports.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1912709

Title:
  Having 'js' folder in theme breaks HTML exports

Status in Mahara:
  Invalid

Bug description:
  We've created a custom theme for a client and added some JavaScript to
  tweak something minor when viewing a collection. This file was put in
  `<siteroot>/mahara/htdocs/theme/customtheme/js/theme.js`.

  When exporting a portfolio, it looks like the HTML files are exported with the assumption that all the necessary js files are in the active theme's `js` folder.
  For example, in the attached HTML file you'll see the below references in the `<head>` element - files which are not present in the export under the modern theme, but rather the raw theme (I just tested the core theme 'modern' in this case, but the same happens with custom themes):
  ```
  <script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/jquery.js'></script>
  <script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/bootstrap.min.js'></script>
  <script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/dock.js'></script>
  <script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/modal.js'></script>
  <script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/lodash.js'></script>
  <script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/gridstack.js'></script>
  <script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/gridlayout.js'></script>
  <script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/masonry.min.js'></script>
  <script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/select2.full.js'></script>
  <script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/theme.js'></script>
  ```

  From what I can tell, it's due to the code starting at around about `htdocs/export/html/lib.php:876`:
  ```
  $jsdir =  $staticdir . 'theme/' . $theme . '/static/js/';
  ```

  It appears to be preventing the blocks from being rendered/populated
  correctly on the page and the page appears mostly blank.

  As a workaround, we added the snippet of JS to
  `$cfg->additionalhtmlhead` for now and removed the `js` folder from
  the theme.

  Not sure if this is expected behaviour or a bug or enhancement I'm recommending! :)
  But hope it helps.

  
  ------------------------------
  Application/System version(s):
  Mahara
  $config->version = 2020013013;
  $config->series = '20.04';
  $config->release = '20.04.2';

  OS
  Ubuntu 18.04.5 LTS

  DB
  MySQL 5.7
  ------------------------------

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1912709/+subscriptions


References