1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-31 06:40:39 +00:00

[contact] bugfix, improvement

This commit is contained in:
llj 2015-06-13 18:42:13 +08:00
parent 5442eac171
commit dbbfd393bb
4 changed files with 8 additions and 17 deletions

View File

@ -12,7 +12,7 @@ from django.contrib import messages
from django.utils.translation import ugettext as _
from models import Contact, ContactAddForm, ContactEditForm
from seahub.auth.decorators import login_required
from seahub.auth.decorators import login_required, login_required_ajax
from seahub.base.decorators import user_mods_check
from seahub.profile.models import Profile
from seahub.utils import render_error, is_valid_email
@ -49,7 +49,7 @@ def contact_list(request):
# 'edit_form': edit_form,
}, context_instance=RequestContext(request))
@login_required
@login_required_ajax
def contact_add(request):
"""
Handle ajax post to add a contact.
@ -86,7 +86,7 @@ def contact_add(request):
messages.error(request, _(u"Failed to add %s to contacts.") % contact_email)
return HttpResponse(json.dumps(result), status=500, content_type=content_type)
@login_required
@login_required_ajax
def contact_edit(request):
"""
Ajax post to edit contact info.

View File

@ -9,7 +9,7 @@
border-radius:3px;
text-align:center;
}
.add-to-contacts, #send-msg {
#send-msg {
margin-top:8px;
}
</style>

View File

@ -35,7 +35,6 @@ define([
Common.prepareApiCsrf();
Common.initAccountPopup();
Common.initNoticePopup();
Common.getContacts();
this.dirView = new DirView();

View File

@ -468,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;
@ -506,14 +496,16 @@ define([
contactInputOptionsForSelect2: function() {
var _this = this;
return {
placeholder: gettext("Enter emails or select contacts"),
placeholder: gettext("Search users"),
// with 'tags', the user can directly enter, not just select
// tags need `<input type="hidden" />`, not `<select>`
tags: true,
tags: [],
tokenSeparators: [",", " "],
minimumInputLength: 1, // input at least 1 character
ajax: {
url: _this.getUrl({name: 'search_user'}),
dataType: 'json',