mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 17:02:47 +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,
|
delay: 100,
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function(request, response) {
|
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() {
|
focus: function() {
|
||||||
return false;
|
return false;
|
||||||
@@ -66,7 +69,7 @@ function addAutocomplete(ele_id, container_id, data) {
|
|||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
var terms = split(this.value);
|
var terms = split(this.value);
|
||||||
terms.pop();
|
terms.pop();
|
||||||
terms.push(ui.item.value);
|
terms.push(ui.item.label);
|
||||||
terms.push("");
|
terms.push("");
|
||||||
this.value = terms.join(", ");
|
this.value = terms.join(", ");
|
||||||
return false;
|
return false;
|
||||||
|
@@ -1,12 +1,15 @@
|
|||||||
|
{% load seahub_tags avatar_tags %}
|
||||||
$(function() {
|
$(function() {
|
||||||
//repo-share-form share-list autocomplete
|
//repo-share-form share-list autocomplete
|
||||||
var share_list = [];
|
var share_list = [], group_name, group_name_py;
|
||||||
{% for contact in contacts %}
|
{% for contact in contacts %}
|
||||||
share_list.push('{{ contact.contact_email }}');
|
share_list.push('{{ contact.contact_email }}');
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% for group in groups %}
|
{% 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 %}
|
{% endfor %}
|
||||||
|
|
||||||
$(".repo-share-btn").click(function() {
|
$(".repo-share-btn").click(function() {
|
||||||
|
Reference in New Issue
Block a user