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

Trigger native JS events from inplace editable elements

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.0
    • 4.0
    • JavaScript
    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • Hide

      Native events

      1. Install mdl72291.zip in your local/ directory
      2. Login as admin
      3. Navigate to following URL:

        <YOURMOODLE>/local/mdl72291/index.php
        

      4. Open your browser console from developer tools
      5. Edit the "One" editable elements, change it to "Hello"
      6. Confirm you see the following in your console:

        Element "one" updated: Hello
        

      7. Edit the "Two" editable elements, change it to "Goodbye"
      8. Confirm you see the following in your console:

        Element "two" updated: Goodbye
        

      9. Edit the "Fail (custom)" editable elements, change it to "Orange"
      10. Confirm you see the following in your console:

        Element "fail" update failed: Orange
        Prevented default: Coding error detected, it must be fixed by a programmer: It failed
        

      11. Confirm you don't see a web service exception modal dialogue
      12. Edit the "Fail (default)" editable elements, change it to "Apple"
      13. Confirm you see the following in your console:

        Element "fail" update failed: Apple
        

      14. Confirm you do see a web service exception modal dialogue

      Legacy jQuery events

      1. Login as admin
      2. Navigate to Appearance > Manage tags in site administration
      3. Press Default collection
      4. Press Add standard tags
      5. Enter "tagone,tagtwo" and save
      6. Reload the page (to make the Modified column values change)
      7. Press the edit icon for "tagone" in the Tag name column
      8. Enter "tagcool" and press enter
      9. Confirm the Modified column for tag was updated to "now" (we caught the legacy updated event)
      10. Press the edit icon for "tagtwo" in the Tag name column
      11. Enter "tagcool" and press enter
      12. Confirm you don't see a web service exception message
      13. Confirm you see a confirmation dialogue asking you to combine the tags (we caught the legacy updatefailed event)
      14. Press Yes
      15. Confirm tags were combined
      Show
      Native events Install mdl72291.zip in your local/ directory Login as admin Navigate to following URL: <YOURMOODLE>/local/mdl72291/index.php Open your browser console from developer tools Edit the "One" editable elements, change it to "Hello" Confirm you see the following in your console: Element "one" updated: Hello Edit the "Two" editable elements, change it to "Goodbye" Confirm you see the following in your console: Element "two" updated: Goodbye Edit the "Fail (custom)" editable elements, change it to "Orange" Confirm you see the following in your console: Element "fail" update failed: Orange Prevented default: Coding error detected, it must be fixed by a programmer: It failed Confirm you don't see a web service exception modal dialogue Edit the "Fail (default)" editable elements, change it to "Apple" Confirm you see the following in your console: Element "fail" update failed: Apple Confirm you do see a web service exception modal dialogue Legacy jQuery events Login as admin Navigate to Appearance > Manage tags in site administration Press Default collection Press Add standard tags Enter "tagone,tagtwo" and save Reload the page (to make the Modified column values change) Press the edit icon for "tagone" in the Tag name column Enter "tagcool" and press enter Confirm the Modified column for tag was updated to "now" (we caught the legacy updated event) Press the edit icon for "tagtwo" in the Tag name column Enter "tagcool" and press enter Confirm you don't see a web service exception message Confirm you see a confirmation dialogue asking you to combine the tags (we caught the legacy updatefailed event) Press Yes Confirm tags were combined

    Description

      They currently trigger Jquery events - switch to native events so the module doesn't introduce Jquery dependencies on calling code that wants to listen to those events

      Maybe using the same b/c method as described/implemented in MDL-70990

      Attachments

        Activity

          People

            pholden Paul Holden
            pholden Paul Holden
            David Matamoros David Matamoros
            Andrew Lyons Andrew Lyons
            Gladys Basiana Gladys Basiana
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              19/Apr/22

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 20 minutes
                3h 20m