mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 08:28:11 +00:00
[repo-share-form]add autocomplete
This commit is contained in:
@@ -234,3 +234,14 @@ input.ccnet_id { width: 400px; }
|
||||
font-size:16px;
|
||||
margin-bottom:14px;
|
||||
}
|
||||
/*repo-share-form*/
|
||||
#to_email {
|
||||
width:260px;
|
||||
height:80px;
|
||||
}
|
||||
.text-core {
|
||||
width:272px;
|
||||
}
|
||||
.text-suggestion {
|
||||
background:none;
|
||||
}
|
||||
|
9
media/js/jquery.textext.js
Normal file
9
media/js/jquery.textext.js
Normal file
File diff suppressed because one or more lines are too long
@@ -94,6 +94,7 @@
|
||||
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.simplemodal.1.4.1.min.js"></script>
|
||||
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.cookie.js"></script>
|
||||
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery-ui-1.8.16.custom.min.js"></script>
|
||||
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.textext.js"></script>
|
||||
<script type="text/javascript" src="{{ MEDIA_URL }}js/utils.js"></script>
|
||||
{% block extra_script %}{% endblock %}
|
||||
</body>
|
||||
|
@@ -71,7 +71,7 @@
|
||||
|
||||
<form id="repo-share-form" action="{{ SITE_ROOT }}home/my/" method="post" name="repo-share-form" class="hide">
|
||||
<label>邮箱(多个邮箱以;分隔)</label><br />
|
||||
<textarea id="to_email" name="to_email" value="" cols="30" rows="5" ></textarea><br />
|
||||
<textarea id="to_email" name="to_email"></textarea>
|
||||
<input id="share_repo_id" type="hidden" name="share_repo_id" value="" />
|
||||
<input type="submit" value="提交" />
|
||||
</form>
|
||||
@@ -87,5 +87,31 @@ $(".repo-share-btn").click(function() {
|
||||
});
|
||||
|
||||
addConfirmTo($('.repo-delete-btn'));
|
||||
|
||||
//repo-share-form email autocomplete
|
||||
$('#to_email').textext({
|
||||
plugins: 'autocomplete',
|
||||
autocomplete: {
|
||||
dropdownPosition: 'below',
|
||||
render: function(suggestion) {
|
||||
return suggestion;
|
||||
}
|
||||
},
|
||||
html: {
|
||||
dropdown: '<div class="text-dropdown"><ul class="text-list"></ul></div>',
|
||||
suggestion: '<li class="text-suggestion"><span class="text-label"></span></li>'
|
||||
}
|
||||
})
|
||||
.bind('getSuggestions', function(e, data) {
|
||||
var list = [],
|
||||
textext = $(e.target).textext()[0],
|
||||
query = (data ? data.query : '') || '';
|
||||
|
||||
{% for contact in contacts %}
|
||||
list.push('{{ contact.contact_email }}');
|
||||
{% endfor %}
|
||||
|
||||
$(this).trigger('setSuggestions', { result: textext.itemManager().filter(list, query) });
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
7
views.py
7
views.py
@@ -20,6 +20,8 @@ from seahub.base.accounts import CcnetUser
|
||||
from forms import AddUserForm
|
||||
from urllib import quote
|
||||
|
||||
from seahub.contacts.models import Contact
|
||||
|
||||
import stat
|
||||
import time
|
||||
import settings
|
||||
@@ -300,11 +302,14 @@ def myhome(request):
|
||||
if request.method == 'POST':
|
||||
output_msg = repo_add_share(request)
|
||||
|
||||
contacts = Contact.objects.filter(user_email=email)
|
||||
|
||||
return render_to_response('myhome.html', {
|
||||
"owned_repos": owned_repos,
|
||||
"quota_usage": quota_usage,
|
||||
"in_repos": in_repos,
|
||||
"output_msg": output_msg
|
||||
"output_msg": output_msg,
|
||||
"contacts": contacts,
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
@login_required
|
||||
|
Reference in New Issue
Block a user