id: message.userid,
});
- var promise = Templates.render('message_popup/message_content_item', message)
- .then(function(html, js) {
- container.append(html);
- Templates.runTemplateJS(js);
- return;
- });
+ var promise = Templates.render('message_popup/message_content_item', message);
promises.push(promise);
}.bind(this));
- return $.when.apply($, promises);
+ return $.when.apply($, promises).then(function() {
+ // Each of the promises in the when will pass its results as an argument to the function.
+ // The order of the arguments will be the order that the promises are passed to when()
+ // i.e. the first promise's results will be in the first argument.
+ $.each(arguments, function(index, argument) {
+ // The promises will return an array containing two values.
+ // The first value is the html that should be attached to the page.
+ // The second will be any JavaScript that needs to be run.
+ container.append(argument[0]);
+ Templates.runTemplateJS(argument[1]);
+ });
+ return;
+ });
};
/**
var promise = Templates.render(TEMPLATES.NOTIFICATION, notification)
.then(function(html, js) {
- container.append(html);
- Templates.runTemplateJS(js);
// Restore it for the cache.
notification.contexturl = contextUrl;
this.setCacheNotification(notification);
- return;
+ // Pass the Rendered content out.
+ return [html, js];
}.bind(this));
promises.push(promise);
}.bind(this));
- return $.when.apply($, promises);
+ return $.when.apply($, promises).then(function() {
+ // Each of the promises in the when will pass its results as an argument to the function.
+ // The order of the arguments will be the order that the promises are passed to when()
+ // i.e. the first promise's results will be in the first argument.
+ $.each(arguments, function(index, argument) {
+ // The promises will return an array containing two values.
+ // The first value is the html that should be attached to the page.
+ // The second will be any JavaScript that needs to be run.
+ container.append(argument[0]);
+ Templates.runTemplateJS(argument[1]);
+ });
+ return;
+ });
};
/**
offset: offset,
});
- var promise = Templates.render('message_popup/notification_content_item', notification)
- .then(function(html, js) {
- container.append(html);
- Templates.runTemplateJS(js);
- return;
- });
+ var promise = Templates.render('message_popup/notification_content_item', notification);
promises.push(promise);
}.bind(this));
- return $.when.apply($, promises);
+ return $.when.apply($, promises).then(function() {
+ // Each of the promises in the when will pass its results as an argument to the function.
+ // The order of the arguments will be the order that the promises are passed to when()
+ // i.e. the first promise's results will be in the first argument.
+ $.each(arguments, function(index, argument) {
+ // The promises will return an array containing two values.
+ // The first value is the html that should be attached to the page.
+ // The second will be any JavaScript that needs to be run.
+ container.append(argument[0]);
+ Templates.runTemplateJS(argument[1]);
+ });
+ return;
+ });
};
/**