1
0
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:
xiez
2012-09-24 17:19:38 +08:00
parent 9d73596fd3
commit f90c82b59d
2 changed files with 10 additions and 4 deletions

View File

@@ -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;

View File

@@ -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() {