diff --git a/grade/report/grader/amd/build/feedback_modal.min.js b/grade/report/grader/amd/build/feedback_modal.min.js index 17946594adbe5..b6cbf5d4c8685 100644 --- a/grade/report/grader/amd/build/feedback_modal.min.js +++ b/grade/report/grader/amd/build/feedback_modal.min.js @@ -5,6 +5,6 @@ define("gradereport_grader/feedback_modal",["exports","core/modal_factory","core * @module gradereport_grader/feedback_modal * @copyright 2023 Kevin Percy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modal_factory=_interopRequireDefault(_modal_factory),_notification=_interopRequireDefault(_notification),_ajax=_interopRequireDefault(_ajax),_templates=_interopRequireDefault(_templates);const Selectors_showFeedback='[data-action="feedback"]',fetchFeedback=(courseid,userid,itemid)=>{const request={methodname:"core_grades_get_feedback",args:{courseid:courseid,userid:userid,itemid:itemid}};return _ajax.default.call([request])[0]},registerEventListeners=()=>{document.addEventListener("click",(e=>{const showFeedbackTrigger=e.target.closest(Selectors_showFeedback);if(showFeedbackTrigger){e.preventDefault();(async(courseid,userid,itemid)=>{let feedbackData;try{feedbackData=await fetchFeedback(courseid,userid,itemid)}catch(e){return Promise.reject(e)}return _modal_factory.default.create({removeOnClose:!0,large:!0}).then((modal=>{const body=_templates.default.render("core_grades/feedback_modal",{feedbacktext:feedbackData.feedbacktext,user:{picture:feedbackData.picture,fullname:feedbackData.fullname,additionalfield:feedbackData.additionalfield}});return modal.setBody(body),modal.setTitle(feedbackData.title),modal.show(),modal}))})(showFeedbackTrigger.dataset.courseid,e.target.closest("tr").dataset.uid,e.target.closest("td").dataset.itemid).catch(_notification.default.exception)}}))};_exports.init=()=>{registerEventListeners()}})); + */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modal_factory=_interopRequireDefault(_modal_factory),_notification=_interopRequireDefault(_notification),_ajax=_interopRequireDefault(_ajax),_templates=_interopRequireDefault(_templates);const Selectors_showFeedback='[data-action="feedback"]',fetchFeedback=(courseid,userid,itemid)=>{const request={methodname:"core_grades_get_feedback",args:{courseid:courseid,userid:userid,itemid:itemid}};return _ajax.default.call([request])[0]},registerEventListeners=()=>{document.addEventListener("click",(e=>{const showFeedbackTrigger=e.target.closest(Selectors_showFeedback);if(showFeedbackTrigger){e.preventDefault();(async(courseid,userid,itemid)=>{let feedbackData;try{feedbackData=await fetchFeedback(courseid,userid,itemid)}catch(e){return Promise.reject(e)}return _modal_factory.default.create({removeOnClose:!0,large:!0,verticallyCentered:!0}).then((modal=>{const body=_templates.default.render("core_grades/feedback_modal",{feedbacktext:feedbackData.feedbacktext,user:{picture:feedbackData.picture,fullname:feedbackData.fullname,additionalfield:feedbackData.additionalfield}});return modal.setBody(body),modal.setTitle(feedbackData.title),modal.show(),modal}))})(showFeedbackTrigger.dataset.courseid,e.target.closest("tr").dataset.uid,e.target.closest("td").dataset.itemid).catch(_notification.default.exception)}}))};_exports.init=()=>{registerEventListeners()}})); //# sourceMappingURL=feedback_modal.min.js.map \ No newline at end of file diff --git a/grade/report/grader/amd/build/feedback_modal.min.js.map b/grade/report/grader/amd/build/feedback_modal.min.js.map index 3d4f0f455852c..784169cd6b755 100644 --- a/grade/report/grader/amd/build/feedback_modal.min.js.map +++ b/grade/report/grader/amd/build/feedback_modal.min.js.map @@ -1 +1 @@ -{"version":3,"file":"feedback_modal.min.js","sources":["../src/feedback_modal.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Javascript module for displaying feedback in a modal window\n *\n * @module gradereport_grader/feedback_modal\n * @copyright 2023 Kevin Percy \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport ModalFactory from 'core/modal_factory';\nimport Notification from 'core/notification';\nimport ajax from 'core/ajax';\nimport Templates from 'core/templates';\n\nconst Selectors = {\n showFeedback: '[data-action=\"feedback\"]'\n};\n\n/**\n * Create the modal to display the feedback.\n *\n * @param {int} courseid\n * @param {int} userid\n * @param {int} itemid\n * @returns {Promise}\n */\nconst getModal = async(courseid, userid, itemid) => {\n let feedbackData;\n\n try {\n feedbackData = await fetchFeedback(courseid, userid, itemid);\n } catch (e) {\n return Promise.reject(e);\n }\n\n return ModalFactory.create({\n removeOnClose: true,\n large: true\n })\n .then(modal => {\n const body = Templates.render('core_grades/feedback_modal', {\n feedbacktext: feedbackData.feedbacktext,\n user: {\n picture: feedbackData.picture,\n fullname: feedbackData.fullname,\n additionalfield: feedbackData.additionalfield,\n },\n });\n\n modal.setBody(body);\n modal.setTitle(feedbackData.title);\n modal.show();\n\n return modal;\n });\n};\n\n/**\n * Fetch the feedback data.\n *\n * @param {int} courseid\n * @param {int} userid\n * @param {int} itemid\n * @returns {Promise}\n */\nconst fetchFeedback = (courseid, userid, itemid) => {\n const request = {\n methodname: 'core_grades_get_feedback',\n args: {\n courseid: courseid,\n userid: userid,\n itemid: itemid,\n },\n };\n return ajax.call([request])[0];\n};\n\n/**\n * Register event listeners for the View Feedback links.\n */\nconst registerEventListeners = () => {\n document.addEventListener('click', e => {\n const showFeedbackTrigger = e.target.closest(Selectors.showFeedback);\n if (showFeedbackTrigger) {\n e.preventDefault();\n\n const courseid = showFeedbackTrigger.dataset.courseid;\n const userid = e.target.closest('tr').dataset.uid;\n const itemid = e.target.closest('td').dataset.itemid;\n\n getModal(courseid, userid, itemid)\n .catch(Notification.exception);\n }\n });\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n registerEventListeners();\n};\n"],"names":["Selectors","fetchFeedback","courseid","userid","itemid","request","methodname","args","ajax","call","registerEventListeners","document","addEventListener","e","showFeedbackTrigger","target","closest","preventDefault","async","feedbackData","Promise","reject","ModalFactory","create","removeOnClose","large","then","modal","body","Templates","render","feedbacktext","user","picture","fullname","additionalfield","setBody","setTitle","title","show","getModal","dataset","uid","catch","Notification","exception"],"mappings":";;;;;;;oRA2BMA,uBACY,2BAkDZC,cAAgB,CAACC,SAAUC,OAAQC,gBAC/BC,QAAU,CACZC,WAAY,2BACZC,KAAM,CACFL,SAAUA,SACVC,OAAQA,OACRC,OAAQA,gBAGTI,cAAKC,KAAK,CAACJ,UAAU,IAM1BK,uBAAyB,KAC3BC,SAASC,iBAAiB,SAASC,UACzBC,oBAAsBD,EAAEE,OAAOC,QAAQhB,2BACzCc,oBAAqB,CACrBD,EAAEI,iBA1DGC,OAAMhB,SAAUC,OAAQC,cACjCe,iBAGAA,mBAAqBlB,cAAcC,SAAUC,OAAQC,QACvD,MAAOS,UACEO,QAAQC,OAAOR,UAGnBS,uBAAaC,OAAO,CACvBC,eAAe,EACfC,OAAO,IAEVC,MAAKC,cACIC,KAAOC,mBAAUC,OAAO,6BAA8B,CACxDC,aAAcZ,aAAaY,aAC3BC,KAAM,CACFC,QAASd,aAAac,QACtBC,SAAUf,aAAae,SACvBC,gBAAiBhB,aAAagB,0BAItCR,MAAMS,QAAQR,MACdD,MAAMU,SAASlB,aAAamB,OAC5BX,MAAMY,OAECZ,UAqCHa,CAJiB1B,oBAAoB2B,QAAQvC,SAC9BW,EAAEE,OAAOC,QAAQ,MAAMyB,QAAQC,IAC/B7B,EAAEE,OAAOC,QAAQ,MAAMyB,QAAQrC,QAGzCuC,MAAMC,sBAAaC,8BAQhB,KAChBnC"} \ No newline at end of file +{"version":3,"file":"feedback_modal.min.js","sources":["../src/feedback_modal.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Javascript module for displaying feedback in a modal window\n *\n * @module gradereport_grader/feedback_modal\n * @copyright 2023 Kevin Percy \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport ModalFactory from 'core/modal_factory';\nimport Notification from 'core/notification';\nimport ajax from 'core/ajax';\nimport Templates from 'core/templates';\n\nconst Selectors = {\n showFeedback: '[data-action=\"feedback\"]'\n};\n\n/**\n * Create the modal to display the feedback.\n *\n * @param {int} courseid\n * @param {int} userid\n * @param {int} itemid\n * @returns {Promise}\n */\nconst getModal = async(courseid, userid, itemid) => {\n let feedbackData;\n\n try {\n feedbackData = await fetchFeedback(courseid, userid, itemid);\n } catch (e) {\n return Promise.reject(e);\n }\n\n return ModalFactory.create({\n removeOnClose: true,\n large: true,\n verticallyCentered: true,\n })\n .then(modal => {\n const body = Templates.render('core_grades/feedback_modal', {\n feedbacktext: feedbackData.feedbacktext,\n user: {\n picture: feedbackData.picture,\n fullname: feedbackData.fullname,\n additionalfield: feedbackData.additionalfield,\n },\n });\n\n modal.setBody(body);\n modal.setTitle(feedbackData.title);\n modal.show();\n\n return modal;\n });\n};\n\n/**\n * Fetch the feedback data.\n *\n * @param {int} courseid\n * @param {int} userid\n * @param {int} itemid\n * @returns {Promise}\n */\nconst fetchFeedback = (courseid, userid, itemid) => {\n const request = {\n methodname: 'core_grades_get_feedback',\n args: {\n courseid: courseid,\n userid: userid,\n itemid: itemid,\n },\n };\n return ajax.call([request])[0];\n};\n\n/**\n * Register event listeners for the View Feedback links.\n */\nconst registerEventListeners = () => {\n document.addEventListener('click', e => {\n const showFeedbackTrigger = e.target.closest(Selectors.showFeedback);\n if (showFeedbackTrigger) {\n e.preventDefault();\n\n const courseid = showFeedbackTrigger.dataset.courseid;\n const userid = e.target.closest('tr').dataset.uid;\n const itemid = e.target.closest('td').dataset.itemid;\n\n getModal(courseid, userid, itemid)\n .catch(Notification.exception);\n }\n });\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n registerEventListeners();\n};\n"],"names":["Selectors","fetchFeedback","courseid","userid","itemid","request","methodname","args","ajax","call","registerEventListeners","document","addEventListener","e","showFeedbackTrigger","target","closest","preventDefault","async","feedbackData","Promise","reject","ModalFactory","create","removeOnClose","large","verticallyCentered","then","modal","body","Templates","render","feedbacktext","user","picture","fullname","additionalfield","setBody","setTitle","title","show","getModal","dataset","uid","catch","Notification","exception"],"mappings":";;;;;;;oRA2BMA,uBACY,2BAmDZC,cAAgB,CAACC,SAAUC,OAAQC,gBAC/BC,QAAU,CACZC,WAAY,2BACZC,KAAM,CACFL,SAAUA,SACVC,OAAQA,OACRC,OAAQA,gBAGTI,cAAKC,KAAK,CAACJ,UAAU,IAM1BK,uBAAyB,KAC3BC,SAASC,iBAAiB,SAASC,UACzBC,oBAAsBD,EAAEE,OAAOC,QAAQhB,2BACzCc,oBAAqB,CACrBD,EAAEI,iBA3DGC,OAAMhB,SAAUC,OAAQC,cACjCe,iBAGAA,mBAAqBlB,cAAcC,SAAUC,OAAQC,QACvD,MAAOS,UACEO,QAAQC,OAAOR,UAGnBS,uBAAaC,OAAO,CACvBC,eAAe,EACfC,OAAO,EACPC,oBAAoB,IAEvBC,MAAKC,cACIC,KAAOC,mBAAUC,OAAO,6BAA8B,CACxDC,aAAcb,aAAaa,aAC3BC,KAAM,CACFC,QAASf,aAAae,QACtBC,SAAUhB,aAAagB,SACvBC,gBAAiBjB,aAAaiB,0BAItCR,MAAMS,QAAQR,MACdD,MAAMU,SAASnB,aAAaoB,OAC5BX,MAAMY,OAECZ,UAqCHa,CAJiB3B,oBAAoB4B,QAAQxC,SAC9BW,EAAEE,OAAOC,QAAQ,MAAM0B,QAAQC,IAC/B9B,EAAEE,OAAOC,QAAQ,MAAM0B,QAAQtC,QAGzCwC,MAAMC,sBAAaC,8BAQhB,KAChBpC"} \ No newline at end of file diff --git a/grade/report/grader/amd/src/feedback_modal.js b/grade/report/grader/amd/src/feedback_modal.js index 2bf97dcedc850..c81154c748af3 100644 --- a/grade/report/grader/amd/src/feedback_modal.js +++ b/grade/report/grader/amd/src/feedback_modal.js @@ -48,7 +48,8 @@ const getModal = async(courseid, userid, itemid) => { return ModalFactory.create({ removeOnClose: true, - large: true + large: true, + verticallyCentered: true, }) .then(modal => { const body = Templates.render('core_grades/feedback_modal', {