Render help messages via templates.

This commit is contained in:
JC Brand 2017-04-21 18:35:34 +02:00
parent 6af4480c14
commit 0bab19fafd
3 changed files with 8 additions and 1 deletions

View File

@ -133,6 +133,7 @@ require.config({
"form_textarea": "src/templates/form_textarea",
"form_username": "src/templates/form_username",
"group_header": "src/templates/group_header",
"help_message": "src/templates/help_message",
"info": "src/templates/info",
"login_panel": "src/templates/login_panel",
"login_tab": "src/templates/login_tab",

View File

@ -13,6 +13,7 @@
"tpl!new_day",
"tpl!action",
"tpl!message",
"tpl!help_message",
"tpl!toolbar",
"tpl!avatar"
], factory);
@ -22,6 +23,7 @@
tpl_new_day,
tpl_action,
tpl_message,
tpl_help_message,
tpl_toolbar,
tpl_avatar
) {
@ -369,7 +371,10 @@
showHelpMessages: function (msgs, type, spinner) {
var i, msgs_length = msgs.length;
for (i=0; i<msgs_length; i++) {
this.$content.append($('<div class="chat-'+(type||'info')+'">'+msgs[i]+'</div>'));
this.$content.append($(tpl_help_message({
'type': type||'info',
'message': msgs[i]
})));
}
if (spinner === true) {
this.$content.append('<span class="spinner"/>');

View File

@ -0,0 +1 @@
<div class="chat-{{{type}}}">{{{message}}}</div>