mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
@@ -112,6 +112,7 @@ define([
|
||||
case 'set_group_folder_perm': return siteRoot + 'ajax/repo/' + options.repo_id + '/set-group-folder-perm/';
|
||||
case 'starred_files': return siteRoot + 'api2/starredfiles/';
|
||||
case 'shared_repos': return siteRoot + 'api2/shared-repos/' + options.repo_id + '/';
|
||||
case 'search_user': return siteRoot + 'api2/search-user/';
|
||||
}
|
||||
},
|
||||
|
||||
@@ -467,16 +468,6 @@ define([
|
||||
});
|
||||
},
|
||||
|
||||
// get contacts for 'lib/dir/file share'
|
||||
getContacts: function () {
|
||||
this.ajaxGet({
|
||||
'get_url': this.getUrl({name: 'get_user_contacts'}),
|
||||
'after_op_success': function (data) {
|
||||
app.pageOptions.contacts = data["contacts"];
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
closeTopNoticeBar: function () {
|
||||
if (!app.pageOptions.cur_note) {
|
||||
return false;
|
||||
@@ -505,32 +496,50 @@ define([
|
||||
contactInputOptionsForSelect2: function() {
|
||||
var _this = this;
|
||||
return {
|
||||
placeholder: gettext("Enter emails or select contacts"),
|
||||
placeholder: gettext("Search users or enter emails"),
|
||||
|
||||
// with 'tags', the user can directly enter, not just select
|
||||
// tags need `<input type="hidden" />`, not `<select>`
|
||||
tags: function () {
|
||||
var contacts = app.pageOptions.contacts || [];
|
||||
var contact_list = [];
|
||||
for (var i = 0, len = contacts.length; i < len; i++) {
|
||||
contact_list.push({ // 'id' & 'text' are required by the plugin
|
||||
"id": contacts[i].email,
|
||||
// for search. both name & email can be searched.
|
||||
// use ' '(space) to separate name & email
|
||||
"text": contacts[i].name + ' ' + contacts[i].email,
|
||||
"avatar": contacts[i].avatar,
|
||||
"name": contacts[i].name
|
||||
});
|
||||
}
|
||||
return contact_list;
|
||||
},
|
||||
tags: [],
|
||||
|
||||
tokenSeparators: [',', ' '],
|
||||
tokenSeparators: [",", " "],
|
||||
|
||||
minimumInputLength: 1, // input at least 1 character
|
||||
|
||||
ajax: {
|
||||
url: _this.getUrl({name: 'search_user'}),
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
cache: true,
|
||||
data: function (params) {
|
||||
return {
|
||||
q: params
|
||||
};
|
||||
},
|
||||
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
|
||||
"id": users[i].email,
|
||||
// for search. both name & email can be searched.
|
||||
// use ' '(space) to separate name & email
|
||||
"text": users[i].name + ' ' + users[i].email,
|
||||
"avatar": users[i].avatar,
|
||||
"name": users[i].name
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
results: user_list
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
// format items shown in the drop-down menu
|
||||
formatResult: function(item) {
|
||||
if (item.avatar) {
|
||||
return item.avatar + '<span class="text">' + _this.HTMLescape(item.name) + '<br />' + _this.HTMLescape(item.id) + '</span>';
|
||||
return item.avatar + '<span class="text ellipsis">' + _this.HTMLescape(item.name) + '<br />' + _this.HTMLescape(item.id) + '</span>';
|
||||
} else {
|
||||
return; // if no match, show nothing
|
||||
}
|
||||
|
Reference in New Issue
Block a user