From 494e2be680e4c2fff1a4eb697cbc5e8f974c6683 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 1 May 2015 09:41:17 -0400 Subject: [PATCH] (js) Save addressbook search string This allow to show the email address that matches the search string (if it does) --- UI/WebServerResources/js/Contacts/addressbook-model.js | 2 ++ UI/WebServerResources/js/Contacts/card-model.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/UI/WebServerResources/js/Contacts/addressbook-model.js b/UI/WebServerResources/js/Contacts/addressbook-model.js index 6fc81ae1a..a4dbaa2a5 100644 --- a/UI/WebServerResources/js/Contacts/addressbook-model.js +++ b/UI/WebServerResources/js/Contacts/addressbook-model.js @@ -160,6 +160,7 @@ // Add 'isOwned' and 'isSubscription' attributes based on active user (TODO: add it server-side?) this.isOwned = AddressBook.activeUser.isSuperUser || this.owner == AddressBook.activeUser.login; this.isSubscription = !this.isRemote && this.owner != AddressBook.activeUser.login; + this.$query = undefined; }; /** @@ -197,6 +198,7 @@ var futureAddressBookData = AddressBook.$$resource.fetch(addressbookId, 'view', params); return futureAddressBookData.then(function(data) { var cards; + _this.$query = search; if (options && options.dry) { // Don't keep a copy of the resulting cards. // This is usefull when doing autocompletion. diff --git a/UI/WebServerResources/js/Contacts/card-model.js b/UI/WebServerResources/js/Contacts/card-model.js index 69b0a2703..fe59e704b 100644 --- a/UI/WebServerResources/js/Contacts/card-model.js +++ b/UI/WebServerResources/js/Contacts/card-model.js @@ -235,7 +235,7 @@ Card.prototype.$preferredEmail = function(partial) { var email, re; if (partial) { - re = new RegExp(partial); + re = new RegExp(partial, 'i'); email = _.find(this.emails, function(o) { return re.test(o.value); });