mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 07:01:12 +00:00
@@ -341,17 +341,7 @@ function HTMLescape(html){
|
||||
|
||||
function userInputOPtionsForSelect2(user_search_url) {
|
||||
return {
|
||||
|
||||
// with 'tags', the user can directly enter, not just select
|
||||
tags: true,
|
||||
tokenSeparators: [',', ' '],
|
||||
createTag: function(params) {
|
||||
var term = $.trim(params.term);
|
||||
return {
|
||||
'id': term,
|
||||
'text': term
|
||||
};
|
||||
},
|
||||
tags: [],
|
||||
|
||||
minimumInputLength: 1, // input at least 1 character
|
||||
|
||||
@@ -362,10 +352,10 @@ function userInputOPtionsForSelect2(user_search_url) {
|
||||
cache: true,
|
||||
data: function (params) {
|
||||
return {
|
||||
q: params.term
|
||||
q: params
|
||||
};
|
||||
},
|
||||
processResults: function(data) {
|
||||
results: function (data) {
|
||||
var user_list = [], users = data['users'];
|
||||
for (var i = 0, len = users.length; i < len; i++) {
|
||||
user_list.push({ // 'id' & 'text' are required by the plugin
|
||||
@@ -384,19 +374,25 @@ function userInputOPtionsForSelect2(user_search_url) {
|
||||
},
|
||||
|
||||
// format items shown in the drop-down menu
|
||||
templateResult: function(item) {
|
||||
formatResult: function(item) {
|
||||
if (item.avatar_url) {
|
||||
return '<img src="' + item.avatar_url + '" width="32" height="32" class="avatar vam">' + '<span class="text ellipsis vam">' + HTMLescape(item.name) + '<br />' + HTMLescape(item.id) + '</span>';
|
||||
return '<img src="' + item.avatar_url + '" width="32" height="32" class="avatar">' + '<span class="text ellipsis">' + HTMLescape(item.name) + '<br />' + HTMLescape(item.id) + '</span>';
|
||||
} else {
|
||||
return; // if no match, show nothing
|
||||
}
|
||||
},
|
||||
|
||||
// format selected item shown in the input
|
||||
templateSelection: function(item) {
|
||||
formatSelection: function(item) {
|
||||
return HTMLescape(item.name || item.id); // if no name, show the email, i.e., when directly input, show the email
|
||||
},
|
||||
|
||||
createSearchChoice: function(term) {
|
||||
return {
|
||||
'id': $.trim(term)
|
||||
};
|
||||
},
|
||||
|
||||
escapeMarkup: function(m) { return m; }
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user