diff --git a/seahub/views/ajax.py b/seahub/views/ajax.py index 302aec781b..a91be5fe06 100644 --- a/seahub/views/ajax.py +++ b/seahub/views/ajax.py @@ -2426,7 +2426,7 @@ def set_group_folder_perm(request, repo_id): content_type = 'application/json; charset=utf-8' if not (is_pro_version() and ENABLE_FOLDER_PERM): - return HttpResponse(json.dumps({"error": True}), + return HttpResponse(json.dumps({"error": _(u"Permission denied")}), status=403, content_type=content_type) group_id = request.POST.get('group_id', None) diff --git a/static/scripts/app/views/folder-perm.js b/static/scripts/app/views/folder-perm.js index 712acad6b0..9693e1aca8 100644 --- a/static/scripts/app/views/folder-perm.js +++ b/static/scripts/app/views/folder-perm.js @@ -89,34 +89,7 @@ define([ }); // use select2 to 'user' input in 'add user perm' - $('[name="email"]', $add_user_perm).select2({ - placeholder: gettext("Enter emails or select contacts"), - tags: function () { - var contacts = app.pageOptions.contacts || []; - var contact_list = []; - for (var i = 0, len = contacts.length; i < len; i++) { - contact_list.push({ // 'id' & 'text' are required by the plugin - "id": contacts[i].email, - "text": contacts[i].email, - "avatar": contacts[i].avatar, - "name": contacts[i].name - }); - } - return contact_list; - }, - tokenSeparators: [',', ' '], - formatResult: function(item) { // format items shown in the drop-down menu - if (item.avatar) { - return item.avatar + '' + item.name + '
' + item.text + '
'; - } else { - return; // if no match, show nothing - } - }, - formatSelection: function(item) { // format selected item shown in the input - return item.name || item.text; // if no name, show the email, i.e., when directly input, show the email - }, - escapeMarkup: function(m) { return m; } - }); + $('[name="email"]', $add_user_perm).select2(Common.contactInputOptionsForSelect2); // use select2 to 'group' input in 'add group perm' var groups = app.pageOptions.groups || [], diff --git a/static/scripts/app/views/share.js b/static/scripts/app/views/share.js index fa8efd06be..386338847f 100644 --- a/static/scripts/app/views/share.js +++ b/static/scripts/app/views/share.js @@ -405,43 +405,12 @@ define([ }, filePrivateSharePanelInit: function() { - var loading_tip = this.$('.loading-tip'); var form = this.$('#file-private-share-form'); - loading_tip.show(); - $('[name="emails"]', form).select2({ - placeholder: gettext("Enter emails or select contacts"), - width: '400px', - // with 'tags', the user can directly enter, not just select - // tags need ``, not ``, not `