MDL-66074 mod_forum: Implement spinner for user change
authorMathew May <mathewm@hotmail.co.nz>
Sun, 6 Oct 2019 05:34:16 +0000 (13:34 +0800)
committerMathew May <mathewm@hotmail.co.nz>
Wed, 30 Oct 2019 02:23:41 +0000 (10:23 +0800)
mod/forum/amd/build/local/grades/local/grader/user_picker.min.js
mod/forum/amd/build/local/grades/local/grader/user_picker.min.js.map
mod/forum/amd/src/local/grades/local/grader/user_picker.js

index b413235..67a39bd 100644 (file)
Binary files a/mod/forum/amd/build/local/grades/local/grader/user_picker.min.js and b/mod/forum/amd/build/local/grades/local/grader/user_picker.min.js differ
index 331fe30..e69fd6f 100644 (file)
Binary files a/mod/forum/amd/build/local/grades/local/grader/user_picker.min.js.map and b/mod/forum/amd/build/local/grades/local/grader/user_picker.min.js.map differ
index 7945f13..0a9be23 100644 (file)
@@ -24,6 +24,7 @@
 
 import Templates from 'core/templates';
 import Selectors from './user_picker/selectors';
+import {addIconToContainerWithPromise} from 'core/loadingicon';
 
 const templatePath = 'mod_forum/local/grades/local/grader';
 
@@ -120,9 +121,14 @@ class UserPicker {
         this.root.addEventListener('click', async e => {
             const button = e.target.closest(Selectors.actions.changeUser);
             if (button) {
+                const whole = document.querySelector('[data-region="unified-grader"]');
+                const spinner = addIconToContainerWithPromise(whole);
+
                 await this.preChangeUserCallback(this.currentUser);
                 this.updateIndex(parseInt(button.dataset.direction));
                 await this.showUser(this.currentUser);
+
+                spinner.resolve();
             }
         });
     }