diff options
-rw-r--r-- | js/controller/ContentController.js | 14 | ||||
-rw-r--r-- | templates/part.content.php | 25 |
2 files changed, 26 insertions, 13 deletions
diff --git a/js/controller/ContentController.js b/js/controller/ContentController.js index 018c15238..0def46a15 100644 --- a/js/controller/ContentController.js +++ b/js/controller/ContentController.js @@ -223,8 +223,18 @@ app.controller('ContentController', function (Publisher, FeedResource, ItemResou this.activeItem = this.getFirstItem(); + this.userList = []; + this.searchUsers = function(search) { - return UserResource.getUsers(search); + if (search === '') { + this.userList = []; + return; + } + + var response = UserResource.getUsers(search); + response.then((response) => { + this.userList = response.ocs.data.users; + }); }; -}); +});
\ No newline at end of file diff --git a/templates/part.content.php b/templates/part.content.php index a61441ccb..a21ef3a29 100644 --- a/templates/part.content.php +++ b/templates/part.content.php @@ -103,22 +103,25 @@ <p class="label-group">Contacts</p> <form ng-submit="" name="contactForm"> <fieldset> - <input type="text" - class="contact-input" - placeholder="Nom de contact" - title="Nom de contact" - name="contactName" - required> + <input + ng-model="nameQuery" + ng-change="Content.searchUsers(nameQuery)" + type="text" + class="contact-input" + placeholder="Nom de contact" + title="Nom de contact" + name="contactName" + required> <input type="submit" - value="Ajouter" - class="primary"> + value="Ajouter" + class="primary"> </fieldset> </form> - <a>Arnaud</a> - <a>Antoine</a> - <a>Adrien</a> + <a ng-repeat="user in Content.userList"> + {{ user }} + </a> <p class="label-group">Partage réseaux sociaux</p> |