Moodle
  1. Moodle
  2. MDL-34214

JS Error when toggling section visibility

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3.2
    • Component/s: AJAX and JavaScript
    • Labels:
      None
    • Testing Instructions:
      Hide
      1. Open up a course in a drag and drop upload supporting browser (Chrome, Firefox)
      2. Turn editing on
      3. Make sure javascript error console is displayed in your browser (Developer tools in Chrome, Firebug in Firefox)
      4. Make sure that drag and drop upload is enabled (the yellow notification box should appear at the top of the course page)
      5. Hide a section

      Expected result: no javascript errors (apart from, possibly, a 'Refusing to set unsafe header 'user-agent'', or similar)

      Show
      Open up a course in a drag and drop upload supporting browser (Chrome, Firefox) Turn editing on Make sure javascript error console is displayed in your browser (Developer tools in Chrome, Firebug in Firefox) Make sure that drag and drop upload is enabled (the yellow notification box should appear at the top of the course page) Hide a section Expected result: no javascript errors (apart from, possibly, a 'Refusing to set unsafe header 'user-agent'', or similar)
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-34214_dndupload_preview_element
    • Rank:
      42553

      Description

      The JS section visibility toggle also hides all visible activities/resources in that section. It does so by selecting all li.activity and looping through them toggling them if required. It also disables the show/hide button.

      Just noticed that when toggling a section, errors are currently shown. This appears to be caused by dndupload creating a new li for the dndupload-preview which also has the activity class on it.

      There are several potential solutions to this issue:

      • remove the activity class from dndupload-preview;
      • make the toggle handle li.activity with a missing toolbox better
      • both of the above

        Activity

        Hide
        Andrew Nicols added a comment -

        Hi Davo,

        Would be good to have your thoughts on this issue.

        Andrew

        Show
        Andrew Nicols added a comment - Hi Davo, Would be good to have your thoughts on this issue. Andrew
        Hide
        Davo Smith added a comment -

        It's a long time since I wrote the code to generate the preview element - I can't remember, off the top of my head, why I applied the activity class (it may just have been because I used to create the preview on the fly, then convert it into the real element, now I show/hide the preview and create a new real element).

        I'll investigate and get back to you.

        Show
        Davo Smith added a comment - It's a long time since I wrote the code to generate the preview element - I can't remember, off the top of my head, why I applied the activity class (it may just have been because I used to create the preview on the fly, then convert it into the real element, now I show/hide the preview and create a new real element). I'll investigate and get back to you.
        Hide
        Davo Smith added a comment -

        Andrew - could you review this?

        Removed the 'activity resource modtype_resource' classes from the preview element. They were left over from earlier development of the dndupload plugin and I hadn't considered them again until now.

        I've added a 'list-style:none' to the CSS for the preview element, as that appears to be the only desired style lost by the class changes.

        Show
        Davo Smith added a comment - Andrew - could you review this? Removed the 'activity resource modtype_resource' classes from the preview element. They were left over from earlier development of the dndupload plugin and I hadn't considered them again until now. I've added a 'list-style:none' to the CSS for the preview element, as that appears to be the only desired style lost by the class changes.
        Hide
        Andrew Nicols added a comment -

        Looks good to me. Feel free to submit for IR whenever you're ready.

        Show
        Andrew Nicols added a comment - Looks good to me. Feel free to submit for IR whenever you're ready.
        Hide
        Dan Poltawski added a comment -

        The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

        TIA and ciao

        Show
        Dan Poltawski added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
        Hide
        Sam Hemelryk added a comment -

        Thanks guys, changes look good and have been integrated now

        Show
        Sam Hemelryk added a comment - Thanks guys, changes look good and have been integrated now
        Hide
        Sam Hemelryk added a comment -

        Oh can you please add testing instructions ASAP.

        Show
        Sam Hemelryk added a comment - Oh can you please add testing instructions ASAP.
        Hide
        Frédéric Massart added a comment -

        Tested on master. Passes! Cheers \o/

        Show
        Frédéric Massart added a comment - Tested on master. Passes! Cheers \o/
        Hide
        Dan Poltawski added a comment -

        *Notice*: Undefined variable: friendlyintegrator in /Users/danp/git/tokenintegrationthanks.php on line 26

        Congratulations

        {tracker.user.name}

        !

        You've made into Moodle

        {tracker.fixversion-1}

        +

        I would like to personally thank you for this contribution on behalf of all Moodle users throughout the world.

        cheers!

        {tracker.friendlyintegrator}
        Show
        Dan Poltawski added a comment - * Notice *: Undefined variable: friendlyintegrator in /Users/danp/git/tokenintegrationthanks.php on line 26 Congratulations {tracker.user.name} ! You've made into Moodle {tracker.fixversion-1} + I would like to personally thank you for this contribution on behalf of all Moodle users throughout the world. cheers! {tracker.friendlyintegrator}

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: