From de4824077eecee0e76da422b039ff34428eef3ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20M=C3=BCller?= Date: Thu, 21 Jan 2016 22:22:26 +0100 Subject: [PATCH 1/3] First try for shareWithField error message Second try for ShareWithField error message --- core/js/sharedialogview.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 4cebf7962e8..52e46664853 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -196,9 +196,16 @@ var suggestions = users.concat(groups).concat(remotes); if (suggestions.length > 0) { + $('.shareWithField').removeClass('error'); + $('.shareWithField').tooltip('hide') $('.shareWithField').autocomplete("option", "autoFocus", true); response(suggestions); + } else { + $('.shareWithField').addClass('error'); + $('.shareWithField').attr('title', t('core', 'No users or groups found for ' + $('.shareWithField').val())); + $('.shareWithField').tooltip({placement: 'bottom', trigger: 'manual'}); + $('.shareWithField').tooltip('show'); response(); } } else { From 113bfb0b072f274fca6116153bf3c83d645b21c7 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 12 Feb 2016 10:04:11 +0100 Subject: [PATCH 2/3] Update tooltip on new search --- core/js/sharedialogview.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 52e46664853..72d57c0c667 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -196,16 +196,20 @@ var suggestions = users.concat(groups).concat(remotes); if (suggestions.length > 0) { - $('.shareWithField').removeClass('error'); - $('.shareWithField').tooltip('hide') - $('.shareWithField').autocomplete("option", "autoFocus", true); + $('.shareWithField').removeClass('error') + .tooltip('hide') + .autocomplete("option", "autoFocus", true); response(suggestions); - } else { - $('.shareWithField').addClass('error'); - $('.shareWithField').attr('title', t('core', 'No users or groups found for ' + $('.shareWithField').val())); - $('.shareWithField').tooltip({placement: 'bottom', trigger: 'manual'}); - $('.shareWithField').tooltip('show'); + $('.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 { From b786523bb7ee25ff784e89692cb77e1f903a90bc Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 12 Feb 2016 10:25:42 +0100 Subject: [PATCH 3/3] Clear error when removing text --- core/js/sharedialogview.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 72d57c0c667..ea7e198cb46 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) {