mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-12 04:12:16 +00:00
[contact] bugfix, improvement
This commit is contained in:
parent
5442eac171
commit
dbbfd393bb
@ -12,7 +12,7 @@ from django.contrib import messages
|
|||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from models import Contact, ContactAddForm, ContactEditForm
|
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.base.decorators import user_mods_check
|
||||||
from seahub.profile.models import Profile
|
from seahub.profile.models import Profile
|
||||||
from seahub.utils import render_error, is_valid_email
|
from seahub.utils import render_error, is_valid_email
|
||||||
@ -49,7 +49,7 @@ def contact_list(request):
|
|||||||
# 'edit_form': edit_form,
|
# 'edit_form': edit_form,
|
||||||
}, context_instance=RequestContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
@login_required
|
@login_required_ajax
|
||||||
def contact_add(request):
|
def contact_add(request):
|
||||||
"""
|
"""
|
||||||
Handle ajax post to add a contact.
|
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)
|
messages.error(request, _(u"Failed to add %s to contacts.") % contact_email)
|
||||||
return HttpResponse(json.dumps(result), status=500, content_type=content_type)
|
return HttpResponse(json.dumps(result), status=500, content_type=content_type)
|
||||||
|
|
||||||
@login_required
|
@login_required_ajax
|
||||||
def contact_edit(request):
|
def contact_edit(request):
|
||||||
"""
|
"""
|
||||||
Ajax post to edit contact info.
|
Ajax post to edit contact info.
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
border-radius:3px;
|
border-radius:3px;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
}
|
}
|
||||||
.add-to-contacts, #send-msg {
|
#send-msg {
|
||||||
margin-top:8px;
|
margin-top:8px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -35,7 +35,6 @@ define([
|
|||||||
Common.prepareApiCsrf();
|
Common.prepareApiCsrf();
|
||||||
Common.initAccountPopup();
|
Common.initAccountPopup();
|
||||||
Common.initNoticePopup();
|
Common.initNoticePopup();
|
||||||
Common.getContacts();
|
|
||||||
|
|
||||||
this.dirView = new DirView();
|
this.dirView = new DirView();
|
||||||
|
|
||||||
|
@ -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 () {
|
closeTopNoticeBar: function () {
|
||||||
if (!app.pageOptions.cur_note) {
|
if (!app.pageOptions.cur_note) {
|
||||||
return false;
|
return false;
|
||||||
@ -506,14 +496,16 @@ define([
|
|||||||
contactInputOptionsForSelect2: function() {
|
contactInputOptionsForSelect2: function() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
return {
|
return {
|
||||||
placeholder: gettext("Enter emails or select contacts"),
|
placeholder: gettext("Search users"),
|
||||||
|
|
||||||
// with 'tags', the user can directly enter, not just select
|
// with 'tags', the user can directly enter, not just select
|
||||||
// tags need `<input type="hidden" />`, not `<select>`
|
// tags need `<input type="hidden" />`, not `<select>`
|
||||||
tags: true,
|
tags: [],
|
||||||
|
|
||||||
tokenSeparators: [",", " "],
|
tokenSeparators: [",", " "],
|
||||||
|
|
||||||
|
minimumInputLength: 1, // input at least 1 character
|
||||||
|
|
||||||
ajax: {
|
ajax: {
|
||||||
url: _this.getUrl({name: 'search_user'}),
|
url: _this.getUrl({name: 'search_user'}),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
Loading…
Reference in New Issue
Block a user