Mentions: use hasAccess user option

This commit is contained in:
Julia Radzhabova 2019-06-25 15:05:14 +03:00
parent fe434165bf
commit dbb0e8e499
2 changed files with 14 additions and 6 deletions

View file

@ -48,10 +48,10 @@ define([
'common/main/lib/collection/Fonts' 'common/main/lib/collection/Fonts'
], function () { 'use strict'; ], function () { 'use strict';
Common.Controllers.Fonts = Backbone.Controller.extend((function() { Common.Controllers.Fonts = Backbone.Controller.extend((function() {
var FONT_TYPE_USERUSED = 4; var FONT_TYPE_RECENT = 4;
function isFontSaved(store, rec) { function isFontSaved(store, rec) {
var out = rec.get('type') == FONT_TYPE_USERUSED, var out = rec.get('type') == FONT_TYPE_RECENT,
i = -1, i = -1,
c = store.length, c = store.length,
su, su,
@ -59,7 +59,7 @@ define([
while (!out && ++i < c) { while (!out && ++i < c) {
su = store.at(i); su = store.at(i);
if (su.get('type') != FONT_TYPE_USERUSED) if (su.get('type') != FONT_TYPE_RECENT)
break; break;
out = su.get('name') == n; out = su.get('name') == n;
@ -78,7 +78,7 @@ define([
// name: data.name, // name: data.name,
// imgidx: data.imgidx, // imgidx: data.imgidx,
// cloneid: node.querySelector('img').id, // cloneid: node.querySelector('img').id,
// type: FONT_TYPE_USERUSED // type: FONT_TYPE_RECENT
// }; // };
// combo.getStore().insert(0,[font]); // combo.getStore().insert(0,[font]);
// //
@ -93,7 +93,7 @@ define([
// } // }
// //
// font = combo.getStore().getAt(5); // font = combo.getStore().getAt(5);
// if (font.data.type==FONT_TYPE_USERUSED) { // if (font.data.type==FONT_TYPE_RECENT) {
// combo.getStore().remove(font); // combo.getStore().remove(font);
// } else { // } else {
// var plugin = combo.getPlugin('scrollpane'); // var plugin = combo.getPlugin('scrollpane');

View file

@ -1047,8 +1047,14 @@ define([
return (item.email && 0 === item.email.toLowerCase().indexOf(str) || item.name && 0 === item.name.toLowerCase().indexOf(str)) return (item.email && 0 === item.email.toLowerCase().indexOf(str) || item.name && 0 === item.name.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>'); 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>'),
divider = false;
_.each(users, function(menuItem, index) { _.each(users, function(menuItem, index) {
if (divider && !menuItem.hasAccess) {
divider = false;
menu.addItem(new Common.UI.MenuItem({caption: '--'}));
}
if (menuItem.email && menuItem.name) { if (menuItem.email && menuItem.name) {
var mnu = new Common.UI.MenuItem({ var mnu = new Common.UI.MenuItem({
caption : menuItem.name, caption : menuItem.name,
@ -1058,6 +1064,8 @@ define([
me.insertEmailToTextbox(item.options.value, left, right); me.insertEmailToTextbox(item.options.value, left, right);
}); });
menu.addItem(mnu); menu.addItem(mnu);
if (menuItem.hasAccess)
divider = true;
} }
}); });
} }