MDL-66077 mod_forum: Basic forum grader implementation
[moodle.git] / mod / forum / amd / build / local / grades / grader.min.js
CommitLineData
bae67469
MM
1define ("mod_forum/local/grades/grader",["exports","core/templates","./local/grader/selectors","./local/grader/user_picker","mod_forum/local/layout/fullscreen"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.launch=void 0;b=f(b);c=f(c);d=function(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}}(d);function f(a){return a&&a.__esModule?a:{default:a}}function g(a,b){return k(a)||j(a,b)||h()}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function j(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g=a[Symbol.iterator](),h;!(d=(h=g.next()).done);d=!0){c.push(h.value);if(b&&c.length===b)break}}catch(a){e=!0;f=a}finally{try{if(!d&&null!=g["return"])g["return"]()}finally{if(e)throw f}}return c}function k(a){if(Array.isArray(a))return a}function l(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 m(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var h=a.apply(b,c);function f(a){l(h,d,e,f,g,"next",a)}function g(a){l(h,d,e,f,g,"throw",a)}f(void 0)})}}var n={grader:{app:"mod_forum/local/grades/grader"}},o=function(a,d){var e=a.querySelector(c.default.regions.pickerRegion);b.default.replaceNodeContents(e,d,"")},p=function(a,d){return function(){var e=m(regeneratorRuntime.mark(function e(f){var h,i,j,k,l;return regeneratorRuntime.wrap(function(e){while(1){switch(e.prev=e.next){case 0:e.next=2;return Promise.all([d(f.id).then(function(a,b){return{html:a,js:b}})]);case 2:h=e.sent;i=g(h,1);j=i[0];k=j.html;l=j.js;b.default.replaceNodeContents(a.querySelector(c.default.regions.moduleReplace),k,l);case 8:case"end":return e.stop();}}},e)}));return function(){return e.apply(this,arguments)}}()},q=function(a){var b=a.getContainer();b.addEventListener("click",function(b){if(b.target.closest(c.default.buttons.toggleFullscreen)){b.stopImmediatePropagation();b.preventDefault();a.toggleFullscreen()}else if(b.target.closest(c.default.buttons.closeGrader)){b.stopImmediatePropagation();b.preventDefault();a.close()}})},r=function(){var a=m(regeneratorRuntime.mark(function a(c,f){var h,i,j,k,l,m,r,s,t,u,v,w=arguments;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:h=2<w.length&&w[2]!==void 0?w[2]:{},i=h.initialUserId,j=void 0===i?0:i;a.next=3;return Promise.all([(0,e.createLayout)({fullscreen:!1,showLoader:!1}),b.default.render(n.grader.app,{}),c()]);case 3:k=a.sent;l=g(k,3);m=l[0];r=l[1];s=l[2];t=m.getContainer();b.default.replaceNodeContents(t,r,"");q(m);u=p(t,f);a.next=14;return d.buildPicker(s,j,u);case 14:v=a.sent;o(t,v);case 16:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.launch=r});
2//# sourceMappingURL=grader.min.js.map