From 92b57c13c1fd68ad3f6f2e4751bd398f05f620aa Mon Sep 17 00:00:00 2001 From: Pete McFarlane Date: Wed, 11 Sep 2013 11:45:32 +0100 Subject: [PATCH 1/2] Added autoFocus to #shareWith autocomplete options --- core/js/share.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/js/share.js b/core/js/share.js index 27c16f38b9..4ec3bb63e1 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -227,7 +227,7 @@ OC.Share={ } }); } - $('#shareWith').autocomplete({minLength: 1, source: function(search, response) { + $('#shareWith').autocomplete({minLength: 1, autoFocus: true, source: function(search, response) { // if (cache[search.term]) { // response(cache[search.term]); // } else { @@ -423,7 +423,7 @@ OC.Share={ dateFormat : 'dd-mm-yy' }); } -} +}; $(document).ready(function() { @@ -512,7 +512,7 @@ $(document).ready(function() { $(document).on('change', '#dropdown .permissions', function() { if ($(this).attr('name') == 'edit') { - var li = $(this).parent().parent() + var li = $(this).parent().parent(); var checkboxes = $('.permissions', li); var checked = $(this).is(':checked'); // Check/uncheck Create, Update, and Delete checkboxes if Edit is checked/unck From 15be3d85b61c93534b1c3a623fb4c19fceb6c444 Mon Sep 17 00:00:00 2001 From: Pete McFarlane Date: Wed, 11 Sep 2013 15:59:28 +0100 Subject: [PATCH 2/2] no autoFocus if no users returned --- core/js/share.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/js/share.js b/core/js/share.js index 4ec3bb63e1..5d34faf8a5 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -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')]); // } }