MDL-59784 core: Modal should accept title as a promise
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+15
-6
@@ -215,23 +215,32 @@ define(['jquery', 'core/templates', 'core/notification', 'core/key_codes',
|
||||
/**
|
||||
* Set the modal title element.
|
||||
*
|
||||
* This method is overloaded to take either a string value for the title or a jQuery promise that is resolved with
|
||||
* HTML most commonly from a Str.get_string call.
|
||||
*
|
||||
* @method setTitle
|
||||
* @param {string} value The title string
|
||||
* @param {(string|object)} value The title string or jQuery promise which resolves to the title.
|
||||
*/
|
||||
Modal.prototype.setTitle = function(value) {
|
||||
var title = this.getTitle();
|
||||
title.html(value);
|
||||
|
||||
if (typeof value === 'string') {
|
||||
title.html(value);
|
||||
} else {
|
||||
value.then(function(content) {
|
||||
return title.html(content);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the modal body element.
|
||||
*
|
||||
* This method is overloaded to take either a string
|
||||
* value for the body or a jQuery promise that is resolved with HTML and Javascript
|
||||
* most commonly from a Templates.render call.
|
||||
* This method is overloaded to take either a string value for the body or a jQuery promise that is resolved with
|
||||
* HTML and Javascript most commonly from a Templates.render call.
|
||||
*
|
||||
* @method setBody
|
||||
* @param {(string|object)} value The body string or jQuery promise
|
||||
* @param {(string|object)} value The body string or jQuery promise which resolves to the body.
|
||||
*/
|
||||
Modal.prototype.setBody = function(value) {
|
||||
var body = this.getBody();
|
||||
|
||||
Reference in New Issue
Block a user