]> source.dussan.org Git - nextcloud-server.git/commitdiff
no autoFocus if no users returned
authorPete McFarlane <peterjohnmcfarlane@gmail.com>
Wed, 11 Sep 2013 14:59:28 +0000 (15:59 +0100)
committerPete McFarlane <peterjohnmcfarlane@gmail.com>
Wed, 11 Sep 2013 14:59:28 +0000 (15:59 +0100)
core/js/share.js

index 4ec3bb63e126ee0a53fd36746deaa2bf53573750..5d34faf8a5db15d9fb26aeee33903a49276247ac 100644 (file)
@@ -227,12 +227,13 @@ OC.Share={
                                        }
                                });
                        }
-                       $('#shareWith').autocomplete({minLength: 1, autoFocus: true, source: function(search, response) {
+                       $('#shareWith').autocomplete({minLength: 1, source: function(search, response) {
        //                      if (cache[search.term]) {
        //                              response(cache[search.term]);
        //                      } else {
                                        $.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getShareWith', search: search.term, itemShares: OC.Share.itemShares }, function(result) {
                                                if (result.status == 'success' && result.data.length > 0) {
+                                                       $( "#shareWith" ).autocomplete( "option", "autoFocus", true );
                                                        response(result.data);
                                                } else {
                                                        // Suggest sharing via email if valid email address
@@ -240,6 +241,7 @@ OC.Share={
 //                                                     if (pattern.test(search.term)) {
 //                                                             response([{label: t('core', 'Share via email:')+' '+search.term, value: {shareType: OC.Share.SHARE_TYPE_EMAIL, shareWith: search.term}}]);
 //                                                     } else {
+                                                               $( "#shareWith" ).autocomplete( "option", "autoFocus", false );
                                                                response([t('core', 'No people found')]);
 //                                                     }
                                                }