Remove loader while loading users for mentions

This commit is contained in:
Julia Radzhabova 2019-04-23 16:59:11 +03:00
parent 81e318634e
commit 9c2d78d589

View file

@ -965,9 +965,7 @@ define([
setUsers: function(data) { setUsers: function(data) {
this.externalUsers = data.data || []; this.externalUsers = data.data || [];
if (this.loadMask) this.isUsersLoading = false;
this.loadMask.hide();
this.loadMask = null;
this._state.emailSearch && this.onEmailListMenu(this._state.emailSearch.str, this._state.emailSearch.left, this._state.emailSearch.right); this._state.emailSearch && this.onEmailListMenu(this._state.emailSearch.str, this._state.emailSearch.left, this._state.emailSearch.right);
}, },
@ -1007,7 +1005,11 @@ define([
right: right right: right
}; };
if (this.loadMask) return; if (this.isUsersLoading) return;
this.isUsersLoading = true;
Common.Gateway.requestUsers();
return;
} }
if (typeof str == 'string') { if (typeof str == 'string') {
var menuContainer = me.$window.find(Common.Utils.String.format('#menu-container-{0}', menu.id)), var menuContainer = me.$window.find(Common.Utils.String.format('#menu-container-{0}', menu.id)),
@ -1038,15 +1040,7 @@ define([
i--; i--;
} }
if (users.length<1) { if (users.length>0) {
menu.addItem(new Common.UI.MenuItem({
template: _.template([
'<div style="height: 95px;"></div>'
].join(''))
}));
this.loadMask = new Common.UI.LoadMask({owner: menu.cmpEl.find('li > div')});
this.loadMask.setTitle(this.textLoading);
} else {
str = str.toLowerCase(); str = str.toLowerCase();
if (str.length>0) { if (str.length>0) {
users = _.filter(users, function(item) { users = _.filter(users, function(item) {
@ -1067,18 +1061,13 @@ define([
}); });
} }
if (users.length>0 || this.loadMask) { if (users.length>0) {
menuContainer.css({left: showPoint[0], top : showPoint[1]}); menuContainer.css({left: showPoint[0], top : showPoint[1]});
menu.menuAlignEl = textbox; menu.menuAlignEl = textbox;
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}); menu.scroller.update({alwaysVisibleY: true});
if (this.loadMask) {
this.loadMask.show();
Common.Gateway.requestUsers();
}
} else { } else {
menu.rendered && menu.cmpEl.css('display', 'none'); menu.rendered && menu.cmpEl.css('display', 'none');
} }