mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 00:20:07 +00:00
Enable pingyin autocomplete in repo share
This commit is contained in:
@@ -58,7 +58,10 @@ function addAutocomplete(ele_id, container_id, data) {
|
||||
delay: 100,
|
||||
minLength: 0,
|
||||
source: function(request, response) {
|
||||
response($.ui.autocomplete.filter(data, extractLast(request.term)));
|
||||
var matcher = new RegExp($.ui.autocomplete.escapeRegex(extractLast(request.term)), "i");
|
||||
response($.grep(data, function(value) {
|
||||
return matcher.test(value.value);
|
||||
}));
|
||||
},
|
||||
focus: function() {
|
||||
return false;
|
||||
@@ -66,7 +69,7 @@ function addAutocomplete(ele_id, container_id, data) {
|
||||
select: function(event, ui) {
|
||||
var terms = split(this.value);
|
||||
terms.pop();
|
||||
terms.push(ui.item.value);
|
||||
terms.push(ui.item.label);
|
||||
terms.push("");
|
||||
this.value = terms.join(", ");
|
||||
return false;
|
||||
|
@@ -1,12 +1,15 @@
|
||||
{% load seahub_tags avatar_tags %}
|
||||
$(function() {
|
||||
//repo-share-form share-list autocomplete
|
||||
var share_list = [];
|
||||
var share_list = [], group_name, group_name_py;
|
||||
{% for contact in contacts %}
|
||||
share_list.push('{{ contact.contact_email }}');
|
||||
{% endfor %}
|
||||
|
||||
{% for group in groups %}
|
||||
share_list.push('{{ group.props.group_name }}');
|
||||
group_name = '{{ group.group_name }}';
|
||||
group_name_py = '{{ group.group_name|char2pinyin }}'
|
||||
share_list.push({value:group_name + group_name_py, label:group_name});
|
||||
{% endfor %}
|
||||
|
||||
$(".repo-share-btn").click(function() {
|
||||
|
Reference in New Issue
Block a user