mirror of
https://github.com/Mibew/mibew.git
synced 2025-06-06 17:16:15 +03:00
Write You instead of user name in the client side
This commit is contained in:
parent
ef7017c783
commit
e30eafb2d0
@ -17,6 +17,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function(Mibew, Handlebars){
|
(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.
|
* Register 'formatTime' Handlebars helper.
|
||||||
*
|
*
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
<span>{{formatTime created}}</span>
|
<span>{{formatTime created}}</span>
|
||||||
{{#if name}}<span class='name-{{kindName}}'>{{name}}</span>: {{/if}}
|
{{#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/>
|
<span class='message-{{kindName}}'>{{#replace "\n" "<br/>"}}{{urlReplace message}}{{/replace}}</span><br/>
|
Loading…
Reference in New Issue
Block a user