diff options
Diffstat (limited to 'core/js/sharedialogview.js')
-rw-r--r-- | core/js/sharedialogview.js | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 02e0e673caa..857d1407ab4 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -67,6 +67,10 @@ /** @type {object} **/ shareeListView: undefined, + events: { + 'input .shareWithField': 'onShareWithFieldChanged' + }, + initialize: function(options) { var view = this; @@ -109,7 +113,18 @@ : options[name]; } - _.bindAll(this, 'autocompleteHandler', '_onSelectRecipient'); + _.bindAll(this, + 'autocompleteHandler', + '_onSelectRecipient', + 'onShareWithFieldChanged' + ); + }, + + onShareWithFieldChanged: function() { + var $el = this.$el.find('.shareWithField'); + if ($el.val().length < 2) { + $el.removeClass('error').tooltip('hide'); + } }, autocompleteHandler: function (search, response) { @@ -196,9 +211,20 @@ var suggestions = users.concat(groups).concat(remotes); if (suggestions.length > 0) { - $('.shareWithField').autocomplete("option", "autoFocus", true); + $('.shareWithField').removeClass('error') + .tooltip('hide') + .autocomplete("option", "autoFocus", true); response(suggestions); } else { + $('.shareWithField').addClass('error') + .attr('data-original-title', t('core', 'No users or groups found for {search}', {search: $('.shareWithField').val()})) + .tooltip('hide') + .tooltip({ + placement: 'bottom', + trigger: 'manual', + }) + .tooltip('fixTitle') + .tooltip('show'); response(); } } else { @@ -219,7 +245,11 @@ if (item.value.shareType === OC.Share.SHARE_TYPE_GROUP) { text = text + ' ('+t('core', 'group')+')'; } else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE) { - text = text + ' ('+t('core', 'remote')+')'; + if (item.value.server) { + text = text + ' (' + t('core', 'at') + ' ' + item.value.server + ')'; + } else { + text = text + ' (' + t('core', 'remote') + ')'; + } } insert.text(text); if(item.value.shareType === OC.Share.SHARE_TYPE_GROUP) { |