From 77ee8778a841a0bf45e6886b6969b89e1a6207d2 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 3 Oct 2019 11:35:21 +0800 Subject: [PATCH] MDL-66828 mod_forum: Display notification on grade save Part of MDL-66074 --- .../amd/build/local/grades/grader.min.js | Bin 3558 -> 4053 bytes .../amd/build/local/grades/grader.min.js.map | Bin 7742 -> 8357 bytes mod/forum/amd/src/local/grades/grader.js | 20 ++++++++++++++++-- mod/forum/lang/en/forum.php | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/mod/forum/amd/build/local/grades/grader.min.js b/mod/forum/amd/build/local/grades/grader.min.js index b2cfa92eb6d092df06602f3ae18b6b20b79dc357..5ee007bba2c258b4d466ed4d3ef3f1a938a131a1 100644 GIT binary patch delta 914 zcmYjPL2DC16lR+yX_`jGQYyC8bVWMTj_dBWTG(Zw7r}baLlK0qluc%m-Db0!%ubSO z68aaE0R<0&{)HYqRK0mn=t+9=Cg{yypa&<}-O|f@vv0n)^L_7qzn9K#y!fOexfW7# zhlNhW)ABwqI04LD@?T-ii2_5vz_z+6}d`-uzj&=FK9p@H>iV2WW>qo5nK4Fy1EnJanj?gXJ zK!qlAY1l81FB1G+W85c`0Lwbf0?^C!+@~OGb`em((UVAaEM%(j$q4pZaMLeI{aa&E%o?GY2!ap CKq!&` delta 544 zcmYLFPiqrF9A(I#Cc-8JM8pb-igYIZ**4oEm}Q`-2fg(u$Q~xy&1U~(c6WBSwl?uI zD8GZ>L2uSmrG5tyFWx-pRS?007iX=hm-l-!ya(^SPu*{;&rdJeFe&6X_hU%~j9?57 zxG;I~{awSOBW8`ccl?GtAZ?FMn6;GlJZx6X{VYUt|GPh?AeLmU9T$x(|pHd%8W`&vrkGJfS zM?BQbn&~sJEy)8UjhAcbKlflTjFXMchZg8#rbe}m}Ers>6fID5`~=ljmtZ}!{V2mIw{Vvy4?^2HDu zBCfl^NGRlw#Me6wf+G{763*#hVYFX~Q}pP_#EYHxmp=9x>vH+()rsSXGT*9;EZ2$aSKbCRO3SMy|ov-S=oDm&mPAW(1_-#2~pNd8Wxjmb{m zwU>R{Uj2Y^0WD=bkPv$Qw_%sFI%FKiX;$bP$;@sCz2+(vJE7oSP}Lk&t;fX$lEOQ$ zu7A36oE;tA4qy}tRDh^a*o^{5cr1V@q%H^sAvvT#bjhL0iA%?If6Q4pAe_{pmGfzx z2BHm|F##J&#bJRU9u4?~zWj-H8$v1yS}SieUeU^$bUIqph=7LY`|v_Z5#Oh7JQNl< z6%h}hb*iNGvvMN6ygqb>{A { }); }; +/** + * Get the function used to save a user grade. + * + * @param {Element} root The contaienr + * @param {Function} setGradeForUser The function that will be called. + * @return {Function} + */ const getSaveUserGradeFunction = (root, setGradeForUser) => { - return user => { - return setGradeForUser(user.id, root.querySelector(Selectors.regions.gradingPanel)); + return async user => { + try { + const result = await setGradeForUser(user.id, root.querySelector(Selectors.regions.gradingPanel)); + addToast(await getString('grades:gradesavedfor', 'mod_forum', user)); + + return result; + } catch (error) { + throw error; + } }; }; diff --git a/mod/forum/lang/en/forum.php b/mod/forum/lang/en/forum.php index 29789c6a45e..8d0a9469386 100644 --- a/mod/forum/lang/en/forum.php +++ b/mod/forum/lang/en/forum.php @@ -727,6 +727,7 @@ $string['gradeforwholeforum'] = 'Grade for forum: {$a->str_long_grade}'; $string['gradeforwholeforumhidden'] = 'Grade for forum hidden'; $string['gradeitemnameforwholeforum'] = 'Whole forum grade for {$a->name}'; $string['gradeitemnameforrating'] = 'Rating grade for {$a->name}'; +$string['grades:gradesavedfor'] = 'Grade saved for {$a->fullname}'; // Deprecated since Moodle 3.8. $string['cannotdeletediscussioninsinglediscussion'] = 'You cannot delete the first post in a single discussion'; -- 2.17.1