Show user name and email when adding mentions

This commit is contained in:
Julia Radzhabova 2019-04-23 16:01:34 +03:00
parent 1f977c6393
commit 81e318634e

View file

@ -462,7 +462,7 @@ define([
}); });
this.emailMenu = new Common.UI.Menu({ this.emailMenu = new Common.UI.Menu({
maxHeight: 200, maxHeight: 190,
cyclic: false, cyclic: false,
items: [] items: []
}).on('render:after', function(mnu) { }).on('render:after', function(mnu) {
@ -930,7 +930,6 @@ define([
res = str.match(/^(?:[@]|[+](?!1))(\S*)/); res = str.match(/^(?:[@]|[+](?!1))(\S*)/);
if (res && res.length>1) { if (res && res.length>1) {
str = res[1]; // send to show email menu str = res[1]; // send to show email menu
console.log(str);
me.onEmailListMenu(str, left, right); me.onEmailListMenu(str, left, right);
} }
}); });
@ -1042,7 +1041,7 @@ define([
if (users.length<1) { if (users.length<1) {
menu.addItem(new Common.UI.MenuItem({ menu.addItem(new Common.UI.MenuItem({
template: _.template([ template: _.template([
'<div style="height: 100px;"></div>' '<div style="height: 95px;"></div>'
].join('')) ].join(''))
})); }));
this.loadMask = new Common.UI.LoadMask({owner: menu.cmpEl.find('li > div')}); this.loadMask = new Common.UI.LoadMask({owner: menu.cmpEl.find('li > div')});
@ -1054,11 +1053,15 @@ define([
return (0 === item.email.toLowerCase().indexOf(str)) return (0 === item.email.toLowerCase().indexOf(str))
}); });
} }
var tpl = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem" style="font-size: 12px;"><div><%= caption %></div><div style="color: #909090;"><%= options.value %></div></a>');
_.each(users, function(menuItem, index) { _.each(users, function(menuItem, index) {
var mnu = new Common.UI.MenuItem({ var mnu = new Common.UI.MenuItem({
caption : menuItem.email caption : menuItem.name,
}).on('click', function(item, e) { value : menuItem.email,
me.insertEmailToTextbox(item.caption, left, right); template : tpl
}).on('click', function(item, e) {
me.insertEmailToTextbox(item.options.value, left, right);
}); });
menu.addItem(mnu); menu.addItem(mnu);
}); });
@ -1070,6 +1073,7 @@ define([
menu.show(); menu.show();
menu.cmpEl.css('display', ''); menu.cmpEl.css('display', '');
menu.alignPosition('bl-tl', -5); menu.alignPosition('bl-tl', -5);
menu.scroller.update({alwaysVisibleY: true});
if (this.loadMask) { if (this.loadMask) {
this.loadMask.show(); this.loadMask.show();