Skip to content

Commit

Permalink
MDL-59383 core_modal: trigger event on modal module
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Jul 12, 2017
1 parent 331785d commit d4a87aa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion calendar/amd/build/calendar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions calendar/amd/src/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand Down
2 changes: 1 addition & 1 deletion lib/amd/build/modal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions lib/amd/src/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]',
Expand Down Expand Up @@ -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.
Expand All @@ -257,6 +258,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/key_codes',
this.bodyJS = js;
}
}
Event.notifyFilterContentUpdated(body);
}.bind(this));
}.bind(this));
}
Expand Down

0 comments on commit d4a87aa

Please sign in to comment.