MDL-59383 core_modal: trigger event on modal module
authorSimey Lameze <simey@moodle.com>
Wed, 12 Jul 2017 10:28:11 +0000 (18:28 +0800)
committerSimey Lameze <simey@moodle.com>
Wed, 12 Jul 2017 10:28:11 +0000 (18:28 +0800)
calendar/amd/build/calendar.min.js
calendar/amd/src/calendar.js
lib/amd/build/modal.min.js
lib/amd/src/modal.js

index b01198a..67a1cb2 100644 (file)
Binary files a/calendar/amd/build/calendar.min.js and b/calendar/amd/build/calendar.min.js differ
index 6d1405f..59dc033 100644 (file)
@@ -69,14 +69,7 @@ define(['jquery', 'core/ajax', 'core/str', 'core/templates', 'core/notification'
             }).then(function(eventdata) {
                 return modalPromise.done(function(modal) {
                     modal.setTitle(eventdata.name);
-
-                    Templates.render(
-                        'core_calendar/event_summary_body',
-                        eventdata
-                    ).done(function(html, js) {
-                        Templates.replaceNodeContents(modal.getBody(), html, js);
-                    });
-
+                    modal.setBody(Templates.render('core_calendar/event_summary_body', eventdata));
                     // Hide edit and delete buttons if I don't have permission.
                     if (eventdata.caneditevent == false) {
                         modal.setFooter('');
index 244be47..1b1e4fd 100644 (file)
Binary files a/lib/amd/build/modal.min.js and b/lib/amd/build/modal.min.js differ
index b7e1a1a..36245c1 100644 (file)
@@ -23,8 +23,8 @@
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 define(['jquery', 'core/templates', 'core/notification', 'core/key_codes',
-        'core/custom_interaction_events', 'core/modal_backdrop', 'core/modal_events'],
-     function($, Templates, Notification, KeyCodes, CustomEvents, ModalBackdrop, ModalEvents) {
+        'core/custom_interaction_events', 'core/modal_backdrop', 'core/event', 'core/modal_events'],
+     function($, Templates, Notification, KeyCodes, CustomEvents, ModalBackdrop, Event, ModalEvents) {
 
     var SELECTORS = {
         CONTAINER: '[data-region="modal-container"]',
@@ -239,6 +239,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/key_codes',
         if (typeof value === 'string') {
             // Just set the value if it's a string.
             body.html(value);
+            Event.notifyFilterContentUpdated(body);
         } else {
             // Otherwise we assume it's a promise to be resolved with
             // html and javascript.
@@ -257,6 +258,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/key_codes',
                             this.bodyJS = js;
                         }
                     }
+                    Event.notifyFilterContentUpdated(body);
                 }.bind(this));
             }.bind(this));
         }