summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarco.nassabain@etu.unistra.fr <marco.nassabain@hotmail.com>2021-01-12 23:15:41 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 23:17:31 +0200
commitea4178620be71ce993144fad600647491ba1b3fb (patch)
tree7ba6dfa6b77391ef66bad88765321aa1dc1659bc
parent4a86db338dd19ccada313d22449976b44ad74631 (diff)
🎨 create ShareController and moved share logic
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
-rw-r--r--js/controller/ContentController.js16
-rw-r--r--js/controller/ShareController.js28
-rw-r--r--templates/part.content.php10
3 files changed, 34 insertions, 20 deletions
diff --git a/js/controller/ContentController.js b/js/controller/ContentController.js
index 1d043945a..457700dca 100644
--- a/js/controller/ContentController.js
+++ b/js/controller/ContentController.js
@@ -223,20 +223,4 @@ app.controller('ContentController', function (Publisher, FeedResource, ItemResou
this.activeItem = this.getFirstItem();
- this.userList = [];
-
- this.searchUsers = function(search) {
- // TODO: search === undefined 🤢 je pense pas que c'est ouf comme syntaxe
- if (search === '' || search === undefined) {
- this.userList = [];
- return;
- }
-
- // TODO: bug - requetes retardataires (regarder issues git)
- var response = ShareResource.getUsers(search);
- response.then((response) => {
- this.userList = response.ocs.data.users;
- });
- };
-
}); \ No newline at end of file
diff --git a/js/controller/ShareController.js b/js/controller/ShareController.js
new file mode 100644
index 000000000..4b7f15d0e
--- /dev/null
+++ b/js/controller/ShareController.js
@@ -0,0 +1,28 @@
+/**
+ * Nextcloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Marco Nassabain <marco.nassabain@hotmail.com>
+ */
+app.controller('ShareController', function (ShareResource) {
+ 'use strict';
+
+ this.userList = [];
+
+ this.searchUsers = function(search) {
+ // TODO: search === undefined 🤢 je pense pas que c'est ouf comme syntaxe
+ if (search === '' || search === undefined) {
+ this.userList = [];
+ return;
+ }
+
+ // TODO: bug - requetes retardataires (regarder issues git)
+ var response = ShareResource.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 5c9680c1d..3dcea9bd1 100644
--- a/templates/part.content.php
+++ b/templates/part.content.php
@@ -98,14 +98,16 @@
title="Partager">
</button>
</li>
- <div class="dropdown-content">
+ <div
+ class="dropdown-content"
+ ng-controller="ShareController as Share">
<!-- Contact -->
<p class="label-group">Contacts</p>
<form ng-submit="" name="contactForm">
<fieldset>
- <input
+ <input
ng-model="nameQuery"
- ng-change="Content.searchUsers(nameQuery)"
+ ng-change="Share.searchUsers(nameQuery)"
type="text"
class="contact-input"
placeholder="Nom de contact"
@@ -119,7 +121,7 @@
</form>
- <a ng-repeat="user in Content.userList">
+ <a ng-repeat="user in Share.userList">
{{ user.value.shareWith }}
</a>