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

Main menu block throws javascript fatal error if there is a resource to be opened in a new window

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Follow the steps to reproduce and make sure you reach the expected behaviour.

      Manual Steps (URL)

      1. Log into site as admin
      2. Go to "site home" (in navigation block)
      3. Turn editing on (Administration block > front page settings)
      4. In the Main Menu block "add an activity or resource" and select URL
      5. Fill out the form and make sure the "Display" (under Appearance category) is set to "In pop-up"
      6. Save and return to course
      7. Turn editing off
      8. After the URL resource was added to the Main Menu block, confirm that the javascript executed on the page correctly
        • You can look at the developer console in the browser to make sure it hasn't errored
        • You can also confirm that the "add an activity or resource" link is actually created in the Main Menu block, since it is javascript that converts the text to a hyperlink.
        • Verify that the activity link works as expected ("In pop-up").
      9. Turn editing on
      10. Edit the activity and change "Display" to "In new window".
      11. Save and return to course.
      12. Without turning editing off, verify that the activity link works as expected ("In new window").

      Manual Steps (File)

      1. Repeat the steps above with a file resource, swapping the "In pop-up" and "In new window", so both get tested with editing on and off.

      Automatic

      Run the behat test blocks/site_main_menu/tests/behat/add_url.feature

      Show
      Follow the steps to reproduce and make sure you reach the expected behaviour. Manual Steps (URL) Log into site as admin Go to "site home" (in navigation block) Turn editing on (Administration block > front page settings) In the Main Menu block "add an activity or resource" and select URL Fill out the form and make sure the "Display" (under Appearance category) is set to "In pop-up" Save and return to course Turn editing off After the URL resource was added to the Main Menu block, confirm that the javascript executed on the page correctly You can look at the developer console in the browser to make sure it hasn't errored You can also confirm that the "add an activity or resource" link is actually created in the Main Menu block, since it is javascript that converts the text to a hyperlink. Verify that the activity link works as expected ("In pop-up"). Turn editing on Edit the activity and change "Display" to "In new window". Save and return to course. Without turning editing off , verify that the activity link works as expected ("In new window"). Manual Steps (File) Repeat the steps above with a file resource, swapping the "In pop-up" and "In new window", so both get tested with editing on and off. Automatic Run the behat test blocks/site_main_menu/tests/behat/add_url.feature
    • Workaround:
      Hide

      Edit the front page resource and set the appearance to something other than pop-up or new window.

      Show
      Edit the front page resource and set the appearance to something other than pop-up or new window.
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull Master Branch:
      MDL-50446-master
    • Sprint:
      Team Beards Sprint 9

      Description

      Steps to reproduce

      1. Add the block "Main Menu" to the Front pahe
      2. To the block, add a new resource URL or Page
      3. Set its "Appearance / Display" to "pop-up" or "new window"

      Expected behaviour

      The block should display the link that works as configured

      What actually happens

      There is a fatal Javascript error thrown and the whole JS based UI stops working.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                5 Vote for this issue
                Watchers:
                13 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Sep/15