1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

[folder perm, share] select contacts: enable search contact name

This commit is contained in:
llj
2015-04-30 21:19:35 +08:00
parent 3934bb18ab
commit 70315404b3
3 changed files with 10 additions and 10 deletions

View File

@@ -2423,7 +2423,7 @@ def set_group_folder_perm(request, repo_id):
content_type = 'application/json; charset=utf-8' content_type = 'application/json; charset=utf-8'
if not (is_pro_version() and ENABLE_FOLDER_PERM): if not (is_pro_version() and ENABLE_FOLDER_PERM):
return HttpResponse(json.dumps({"error": True}), return HttpResponse(json.dumps({"error": _(u"Permission denied")}),
status=403, content_type=content_type) status=403, content_type=content_type)
group_id = request.POST.get('group_id', None) group_id = request.POST.get('group_id', None)

View File

@@ -97,7 +97,7 @@ define([
for (var i = 0, len = contacts.length; i < len; i++) { for (var i = 0, len = contacts.length; i < len; i++) {
contact_list.push({ // 'id' & 'text' are required by the plugin contact_list.push({ // 'id' & 'text' are required by the plugin
"id": contacts[i].email, "id": contacts[i].email,
"text": contacts[i].email, "text": contacts[i].name + contacts[i].email, // for search. both name & email can be searched.
"avatar": contacts[i].avatar, "avatar": contacts[i].avatar,
"name": contacts[i].name "name": contacts[i].name
}); });
@@ -107,13 +107,13 @@ define([
tokenSeparators: [',', ' '], tokenSeparators: [',', ' '],
formatResult: function(item) { // format items shown in the drop-down menu formatResult: function(item) { // format items shown in the drop-down menu
if (item.avatar) { if (item.avatar) {
return item.avatar + '<span class="text">' + item.name + '<br />' + item.text + '</span>'; return item.avatar + '<span class="text">' + item.name + '<br />' + item.id + '</span>';
} else { } else {
return; // if no match, show nothing return; // if no match, show nothing
} }
}, },
formatSelection: function(item) { // format selected item shown in the input formatSelection: function(item) { // format selected item shown in the input
return item.name || item.text; // if no name, show the email, i.e., when directly input, show the email return item.name || item.id; // if no name, show the email, i.e., when directly input, show the email
}, },
escapeMarkup: function(m) { return m; } escapeMarkup: function(m) { return m; }
}); });

View File

@@ -420,7 +420,7 @@ define([
for (var i = 0, len = contacts.length; i < len; i++) { for (var i = 0, len = contacts.length; i < len; i++) {
contact_list.push({ // 'id' & 'text' are required by the plugin contact_list.push({ // 'id' & 'text' are required by the plugin
"id": contacts[i].email, "id": contacts[i].email,
"text": contacts[i].email, "text": contacts[i].name + contacts[i].email, // for search. both name & email can be searched.
"avatar": contacts[i].avatar, "avatar": contacts[i].avatar,
"name": contacts[i].name "name": contacts[i].name
}); });
@@ -429,13 +429,13 @@ define([
}, },
formatResult: function(item) { // format items shown in the drop-down menu formatResult: function(item) { // format items shown in the drop-down menu
if (item.avatar) { if (item.avatar) {
return item.avatar + '<span class="text">' + item.name + '<br />' + item.text + '</span>'; return item.avatar + '<span class="text">' + item.name + '<br />' + item.id + '</span>';
} else { } else {
return; // if no match, show nothing return; // if no match, show nothing
} }
}, },
formatSelection: function(item) { // format selected item shown in the input formatSelection: function(item) { // format selected item shown in the input
return item.name || item.text; // if no name, show the email, i.e., when directly input, show the email return item.name || item.id; // if no name, show the email, i.e., when directly input, show the email
}, },
tokenSeparators: [',', ' '], tokenSeparators: [',', ' '],
escapeMarkup: function(m) { return m; } escapeMarkup: function(m) { return m; }
@@ -499,7 +499,7 @@ define([
for (var i = 0, len = contacts.length; i < len; i++) { for (var i = 0, len = contacts.length; i < len; i++) {
contact_list.push({ // 'id' & 'text' are required by the plugin contact_list.push({ // 'id' & 'text' are required by the plugin
"id": contacts[i].email, "id": contacts[i].email,
"text": contacts[i].email, "text": contacts[i].name + contacts[i].email, // for search. both name & email can be searched.
"avatar": contacts[i].avatar, "avatar": contacts[i].avatar,
"name": contacts[i].name "name": contacts[i].name
}); });
@@ -508,13 +508,13 @@ define([
}, },
formatResult: function(item) { // format items shown in the drop-down menu formatResult: function(item) { // format items shown in the drop-down menu
if (item.avatar) { if (item.avatar) {
return item.avatar + '<span class="text">' + item.name + '<br />' + item.text + '</span>'; return item.avatar + '<span class="text">' + item.name + '<br />' + item.id + '</span>';
} else { } else {
return; // if no match, show nothing return; // if no match, show nothing
} }
}, },
formatSelection: function(item) { // format selected item shown in the input formatSelection: function(item) { // format selected item shown in the input
return item.name || item.text; // if no name, show the email, i.e., when directly input, show the email return item.name || item.id; // if no name, show the email, i.e., when directly input, show the email
}, },
tokenSeparators: [',', ' '], tokenSeparators: [',', ' '],
escapeMarkup: function(m) { return m; } escapeMarkup: function(m) { return m; }