Only show label if the shareWith value is relevant
For local users / groups the display name is enough to show, we just need details for email/remote shares Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
836ba4f419
commit
8ed945a519
1 changed files with 24 additions and 17 deletions
|
@ -478,6 +478,24 @@
|
||||||
autocompleteRenderItem: function(ul, item) {
|
autocompleteRenderItem: function(ul, item) {
|
||||||
var icon = 'icon-user';
|
var icon = 'icon-user';
|
||||||
var text = item.label;
|
var text = item.label;
|
||||||
|
var description = '';
|
||||||
|
var type = '';
|
||||||
|
var getTranslatedType = function(type) {
|
||||||
|
switch (type) {
|
||||||
|
case 'HOME':
|
||||||
|
return t('core', 'Home');
|
||||||
|
case 'WORK':
|
||||||
|
return t('core', 'Work');
|
||||||
|
case 'OTHER':
|
||||||
|
return t('core', 'Other');
|
||||||
|
default:
|
||||||
|
return '' + type;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (typeof item.type !== 'undefined' && item.type !== null) {
|
||||||
|
type = getTranslatedType(item.type) + ' ';
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof item.name !== 'undefined') {
|
if (typeof item.name !== 'undefined') {
|
||||||
text = item.name;
|
text = item.name;
|
||||||
}
|
}
|
||||||
|
@ -485,37 +503,26 @@
|
||||||
icon = 'icon-contacts-dark';
|
icon = 'icon-contacts-dark';
|
||||||
} else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE) {
|
} else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE) {
|
||||||
icon = 'icon-shared';
|
icon = 'icon-shared';
|
||||||
|
description += item.value.shareWith;
|
||||||
} else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP) {
|
} else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP) {
|
||||||
text = t('core', '{sharee} (remote group)', { sharee: text }, undefined, { escape: false });
|
text = t('core', '{sharee} (remote group)', { sharee: text }, undefined, { escape: false });
|
||||||
icon = 'icon-shared';
|
icon = 'icon-shared';
|
||||||
|
description += item.value.shareWith;
|
||||||
} else if (item.value.shareType === OC.Share.SHARE_TYPE_EMAIL) {
|
} else if (item.value.shareType === OC.Share.SHARE_TYPE_EMAIL) {
|
||||||
icon = 'icon-mail';
|
icon = 'icon-mail';
|
||||||
|
description += item.value.shareWith;
|
||||||
} else if (item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) {
|
} else if (item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) {
|
||||||
text = t('core', '{sharee} ({type}, {owner})', {sharee: text, type: item.value.circleInfo, owner: item.value.circleOwner}, undefined, {escape: false});
|
text = t('core', '{sharee} ({type}, {owner})', {sharee: text, type: item.value.circleInfo, owner: item.value.circleOwner}, undefined, {escape: false});
|
||||||
icon = 'icon-circle';
|
icon = 'icon-circle';
|
||||||
} else if (item.value.shareType === OC.Share.SHARE_TYPE_ROOM) {
|
} else if (item.value.shareType === OC.Share.SHARE_TYPE_ROOM) {
|
||||||
icon = 'icon-talk';
|
icon = 'icon-talk';
|
||||||
}
|
}
|
||||||
var description = '';
|
|
||||||
var getTranslatedType = function(type) {
|
|
||||||
switch (type) {
|
|
||||||
case 'HOME':
|
|
||||||
return t('core', 'Home');
|
|
||||||
case 'WORK':
|
|
||||||
return t('core', 'Home');
|
|
||||||
case 'OTHER':
|
|
||||||
return t('core', 'Other');
|
|
||||||
default:
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (typeof item.type !== 'undefined' && item.type !== null) {
|
|
||||||
description = getTranslatedType(item.type);
|
|
||||||
}
|
|
||||||
var insert = $("<div class='share-autocomplete-item'/>");
|
var insert = $("<div class='share-autocomplete-item'/>");
|
||||||
if (item.merged) {
|
if (item.merged) {
|
||||||
insert.addClass('merged');
|
insert.addClass('merged');
|
||||||
text = item.value.shareWith;
|
text = item.value.shareWith;
|
||||||
|
description = type;
|
||||||
} else {
|
} else {
|
||||||
var avatar = $("<div class='avatardiv'></div>").appendTo(insert);
|
var avatar = $("<div class='avatardiv'></div>").appendTo(insert);
|
||||||
if (item.value.shareType === OC.Share.SHARE_TYPE_USER || item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) {
|
if (item.value.shareType === OC.Share.SHARE_TYPE_USER || item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) {
|
||||||
|
@ -526,7 +533,7 @@
|
||||||
}
|
}
|
||||||
avatar.imageplaceholder(item.uuid, text, 32);
|
avatar.imageplaceholder(item.uuid, text, 32);
|
||||||
}
|
}
|
||||||
description = item.value.shareWith;
|
description = type + description;
|
||||||
}
|
}
|
||||||
if (description !== '') {
|
if (description !== '') {
|
||||||
insert.addClass('with-description');
|
insert.addClass('with-description');
|
||||||
|
|
Loading…
Reference in a new issue