diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-09-14 18:34:56 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-16 07:23:29 +0200 |
commit | 1933bcfa92d35dfc6ed38569e50c13805dd84396 (patch) | |
tree | 91b21c494f18c7e5a169a8226b7c5304853e4dc8 /core/js/sharedialoglinkshareview.js | |
parent | 62ff78787a0f033ca27a14051affa0be3c9393b2 (diff) | |
download | nextcloud-server-1933bcfa92d35dfc6ed38569e50c13805dd84396.tar.gz nextcloud-server-1933bcfa92d35dfc6ed38569e50c13805dd84396.zip |
Implement email autocomplete for link share
Diffstat (limited to 'core/js/sharedialoglinkshareview.js')
-rw-r--r-- | core/js/sharedialoglinkshareview.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index 599ffd3c43f..1191aa401b4 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -248,6 +248,33 @@ } }); + var $emailField = this.$el.find('#email'); + if (isLinkShare && $emailField.length !== 0) { + $emailField.autocomplete({ + minLength: 1, + source: function (search, response) { + $.get( + OC.generateUrl('core/ajax/share.php'), { + fetch: 'getShareWithEmail', + search: search.term + }, function(result) { + if (result.status == 'success' && result.data.length > 0) { + response(result.data); + } + }); + }, + select: function( event, item ) { + $emailField.val(item.item.email); + return false; + } + }) + .data("ui-autocomplete")._renderItem = function( ul, item ) { + return $('<li>') + .append('<a>' + escapeHTML(item.displayname) + "<br>" + escapeHTML(item.email) + '</a>' ) + .appendTo( ul ); + }; + } + this.delegateEvents(); return this; |