Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-41890

Lazily load moodle-core-popuphelp dependencies

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 2.6
    • None
    • JavaScript
    • MOODLE_26_STABLE
    • Hide

      With the JS console open and watching for errors. You'll also want the Network activity tab open and filtered to show only JavaScript/Scripts

      • open the front page
        • confirm no errors
      • open the login page
        • confirm no errors
        • confirm that not too many dependencies were loaded - certainly not moodle-core-tooltip
      • click on the help icon
        • confirm that the popup was correctly shown
        • confirm that the activity tab showed a couple of new requests for new JS
      • edit lib/outputrenderers.php and search for popuphelp
      • replace:

        $this->page->requires->yui_module('moodle-core-popuphelp', 'M.core.init_popuphelp');
        

        with:

        $this->page->requires->yui_module('moodle-core-popuphelp', 'M.core.init_popuphelp', array(array('preventLazyLoading' => true)));
        

      • refresh the login page
        • confirm that moodle-core-tooltip was included this time
      • click on the help icon for logging in
        • confirm that there are no page loads for new scripts
      Show
      With the JS console open and watching for errors. You'll also want the Network activity tab open and filtered to show only JavaScript/Scripts open the front page confirm no errors open the login page confirm no errors confirm that not too many dependencies were loaded - certainly not moodle-core-tooltip click on the help icon confirm that the popup was correctly shown confirm that the activity tab showed a couple of new requests for new JS edit lib/outputrenderers.php and search for popuphelp replace: $this->page->requires->yui_module('moodle-core-popuphelp', 'M.core.init_popuphelp'); with: $this->page->requires->yui_module('moodle-core-popuphelp', 'M.core.init_popuphelp', array(array('preventLazyLoading' => true))); refresh the login page confirm that moodle-core-tooltip was included this time click on the help icon for logging in confirm that there are no page loads for new scripts

    Description

      We load popuphelp on every page, but since it's a dialogue, it has quite a few dependencies.

      We should attempt to lazily load them rather than loading the entire stack for each page when most of the time, help won't be used.

      I've provided a mechanism to prevent this action as timhunt was looking at ways of seeding the popuphelp with strings to explain what to do in the event that you lose your internet connection during a quiz and we need to therefore have all dependencies pre-loaded already.

      Attachments

        Issue Links

          Activity

            People

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Frédéric Massart Frédéric Massart
              David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: