summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurélien <dav.aurelien@gmail.com>2021-01-28 16:59:20 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 23:17:31 +0200
commit7609fdbabf2dca556873a9c48df4c597f7df209a (patch)
treebca9e22b173a066e999a9de56af3f2e79b6e1d37
parenta78287a77722483a99784c96c694044c22c6921b (diff)
Add Loading for searchUser and share
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
-rw-r--r--css/app.css4
-rw-r--r--js/controller/ShareController.js12
-rw-r--r--templates/part.content.php4
3 files changed, 18 insertions, 2 deletions
diff --git a/css/app.css b/css/app.css
index 7743d956a..fa6f5e8c1 100644
--- a/css/app.css
+++ b/css/app.css
@@ -101,3 +101,7 @@
background-color: rgba(0, 0, 0, 0.1);
font-weight: bold;
}
+
+.right {
+ float: right;
+}
diff --git a/js/controller/ShareController.js b/js/controller/ShareController.js
index 57722f416..b5b252dd6 100644
--- a/js/controller/ShareController.js
+++ b/js/controller/ShareController.js
@@ -6,15 +6,19 @@
*
* @author Marco Nassabain <marco.nassabain@hotmail.com>
*/
-app.controller('ShareController', function (ShareResource) {
+app.controller('ShareController', function (ShareResource, Loading) {
'use strict';
this.userList = [];
this.searchUsers = function(search) {
+
+ Loading.setLoading('user', true);
+
// TODO: search === undefined đŸ¤¢ je pense pas que c'est ouf comme syntaxe
if (search === '' || search === undefined) {
this.userList = [];
+ Loading.setLoading('user', false);
return;
}
@@ -22,13 +26,16 @@ app.controller('ShareController', function (ShareResource) {
var response = ShareResource.getUsers(search);
response.then((response) => {
this.userList = response.ocs.data.users;
+ Loading.setLoading('user', false);
});
};
- // Dict <itemId, List<Int>(user_id)>: Local mapping b/w users & articles: [Article 1 : <Jimmy, Aurelien, ...>, Article 2: <...>]
+ // Dict <itemId, List<Int>(user_id)>: Local mapping b/w users & articles:
+ //[Article 1 : <Jimmy, Aurelien, ...>, Article 2: <...>]
this.usersSharedArticles = {};
this.shareItem = function(itemId, userId) {
+ Loading.setLoading(userId, true);
if (this.usersSharedArticles[itemId] && this.usersSharedArticles[itemId].includes(userId)) {return ; }
// quick initialization (instead of if (...) : [])
@@ -38,6 +45,7 @@ app.controller('ShareController', function (ShareResource) {
var response = ShareResource.shareItem(itemId, userId);
response.then((result) => {
+ Loading.setLoading(userId, false);
return result;
});
};
diff --git a/templates/part.content.php b/templates/part.content.php
index f210508c6..e41813b76 100644
--- a/templates/part.content.php
+++ b/templates/part.content.php
@@ -119,10 +119,14 @@
</form>
+ <div ng-class="{'icon-loading-small': App.loading.isLoading('user') }">
+ </div>
<a
ng-repeat="user in Share.userList"
ng-click="Share.shareItem(item.id, user.value.shareWith)">
{{ user.value.shareWith }}
+ <span class="right"
+ ng-class="{'icon-loading-small': App.loading.isLoading(user.value.shareWith)}"></span>
</a>
<p class="label-group"> <?php p($l->t('Share on social media')) ?> </p>