Write You instead of user name in the client side

This commit is contained in:
Silron88 2015-08-19 02:54:33 +03:00
parent ef7017c783
commit e30eafb2d0
2 changed files with 28 additions and 2 deletions

View File

@ -17,6 +17,26 @@
*/
(function(Mibew, Handlebars){
/**
* Registers "ifAgentSide" helper.
*
* This helper checks if this chat window opened by agent
* <code>
* {{#ifAgentSide}}
* Render some specific agent element
* {{else}}
* Render some specific client element
* {{/ifEqual}}
* </code>
*/
Handlebars.registerHelper('ifAgentSide', function(options) {
if (Mibew.Objects.Models.user.get('isAgent')) {
return options.fn(this);
} else {
return options.inverse(this);
}
});
/**
* Register 'formatTime' Handlebars helper.
*

View File

@ -1,3 +1,9 @@
<span>{{formatTime created}}</span>
{{#if name}}<span class='name-{{kindName}}'>{{name}}</span>: {{/if}}
<span>{{formatTime created}}</span>
{{#if name}}
{{#ifAgentSide}}
<span class='name-{{kindName}}'>{{name}}</span>:
{{else}}
<span class='name-{{kindName}}'>{{#ifEqual kindName "user"}}{{l10n "You"}}{{else}}{{name}}{{/ifEqual}}</span>:
{{/ifAgentSide}}
{{/if}}
<span class='message-{{kindName}}'>{{#replace "\n" "<br/>"}}{{urlReplace message}}{{/replace}}</span><br/>