From dbbfd393bbb802dba5692e463f7f4de43727d945 Mon Sep 17 00:00:00 2001 From: llj Date: Sat, 13 Jun 2015 18:42:13 +0800 Subject: [PATCH] [contact] bugfix, improvement --- seahub/contacts/views.py | 6 +++--- .../profile/templates/profile/user_profile.html | 2 +- static/scripts/app/router.js | 1 - static/scripts/common.js | 16 ++++------------ 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/seahub/contacts/views.py b/seahub/contacts/views.py index 1951365095..9adf8c1f87 100644 --- a/seahub/contacts/views.py +++ b/seahub/contacts/views.py @@ -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. diff --git a/seahub/profile/templates/profile/user_profile.html b/seahub/profile/templates/profile/user_profile.html index df4211da3e..00e518fffc 100644 --- a/seahub/profile/templates/profile/user_profile.html +++ b/seahub/profile/templates/profile/user_profile.html @@ -9,7 +9,7 @@ border-radius:3px; text-align:center; } -.add-to-contacts, #send-msg { +#send-msg { margin-top:8px; } diff --git a/static/scripts/app/router.js b/static/scripts/app/router.js index 8b5dcc64bc..2b32f5c272 100644 --- a/static/scripts/app/router.js +++ b/static/scripts/app/router.js @@ -35,7 +35,6 @@ define([ Common.prepareApiCsrf(); Common.initAccountPopup(); Common.initNoticePopup(); - Common.getContacts(); this.dirView = new DirView(); diff --git a/static/scripts/common.js b/static/scripts/common.js index 2a361cbefa..02b556ec8a 100644 --- a/static/scripts/common.js +++ b/static/scripts/common.js @@ -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 ``, not `