MDL-66893 mod_forum: update navigation bar in grader UI
[moodle.git] / mod / forum / amd / build / grades / grader.min.js
CommitLineData
4c98e56c 1define ("mod_forum/grades/grader",["exports","./grader/selectors","mod_forum/repository","core/templates","../local/grades/grader","core/notification","core_course/repository","core/url"],function(a,b,c,d,e,f,g,h){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.registerLaunchListeners=void 0;b=j(b);c=i(c);d=i(d);e=j(e);f=i(f);g=i(g);function i(a){return a&&a.__esModule?a:{default:a}}function j(a){if(a&&a.__esModule){return a}else{var b={};if(null!=a){for(var c in a){if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};if(d.get||d.set){Object.defineProperty(b,c,d)}else{b[c]=a[c]}}}}b.default=a;return b}}function k(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function l(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var h=a.apply(b,c);function f(a){k(h,d,e,f,g,"next",a)}function g(a){k(h,d,e,f,g,"throw",a)}f(void 0)})}}var m={contentRegion:"mod_forum/grades/grader/discussion/posts"},n=function(a){return function(b){return c.default.getDiscussionByUserID(b,a).then(function(a){a.discussions=a.discussions.map(q);return d.default.render(m.contentRegion,a)}).catch(f.default.exception)}},o=function(a){return l(regeneratorRuntime.mark(function b(){var c;return regeneratorRuntime.wrap(function(b){while(1){switch(b.prev=b.next){case 0:b.next=2;return g.default.getUsersFromCourseModuleID(a);case 2:c=b.sent;return b.abrupt("return",c.users);case 4:case"end":return b.stop();}}},b)}))},p=function(a){return a.closest(b.gradableItem)},q=function(a){var b=new Map;a.posts.parentposts.forEach(function(a){return b.set(a.id,a)});var c=a.posts.userposts.map(function(a){a.subject=null;a.readonly=!0;a.starter=!a.parentid;a.parent=b.get(a.parentid);a.html.rating=null;return a});return{id:a.id,name:a.name,posts:c}},r=function(){var a=l(regeneratorRuntime.mark(function a(b){var c,d;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:c=b.dataset;a.next=3;return e.getGradingPanelFunctions("mod_forum",c.contextid,c.gradingComponent,c.gradingComponentSubtype,c.gradableItemtype);case 3:d=a.sent;a.next=6;return e.launch(o(c.cmid),n(c.cmid),d.getter,d.setter,{groupid:c.groupid,initialUserId:c.initialuserid,moduleName:c.name,courseName:c.courseName,courseUrl:(0,h.relativeUrl)("/course/view.php",{id:c.courseId})});case 6:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.registerLaunchListeners=function registerLaunchListeners(){document.addEventListener("click",function(){var a=l(regeneratorRuntime.mark(function a(c){var d;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:if(!c.target.matches(b.launch)){a.next=17;break}d=p(c.target);if(d){a.next=4;break}throw Error("Unable to find a gradable item");case 4:if(!d.matches(b.gradableItems.wholeForum)){a.next=16;break}c.preventDefault();a.prev=6;a.next=9;return r(d);case 9:a.next=14;break;case 11:a.prev=11;a.t0=a["catch"](6);f.default.exception(a.t0);case 14:a.next=17;break;case 16:throw Error("Unable to find a valid gradable item");case 17:case"end":return a.stop();}}},a,null,[[6,11]])}));return function(){return a.apply(this,arguments)}}())}});
bae67469 2//# sourceMappingURL=grader.min.js.map