AutorÃa | Ultima modificación | Ver Log |
{"version":3,"file":"delete.min.js","sources":["../../../src/bulkactions/grading/delete.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Class that defines the bulk action for removing submissions in the assignment grading page.\n *\n * @module mod_assign/bulkactions/grading/delete\n * @copyright 2024 Shamim Rezaie <shamim@moodle.com>
\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport BulkAction from 'core/bulkactions/bulk_action';\nimport Templates from 'core/templates';\nimport {getString} from 'core/str';\nimport DeleteCancelModal from 'core/modal_delete_cancel';\nimport ModalEvents from 'core/modal_events';\n\nconst Selectors = {\n selectBulkItemCheckbox: 'input[type=\"checkbox\"][name=\"selectedusers\"]:checked',\n};\n\nexport default class extends BulkAction {\n /** @type {number} The course module ID. */\n #cmid;\n\n /** @type {string} The session key. */\n #sesskey;\n\n /**\n * The class constructor.\n *\n * @param {number} cmid The course module ID.\n * @param {string} sesskey The session key.\n */\n constructor(cmid, sesskey) {\n super();\n this.#cmid = cmid;\n this.#sesskey = sesskey;\n }\n\n getBulkActionTriggerSelector() {\n return '[data-type=\"bulkactions\"] [data-action=\"removesubmission\"]';\n }\n\n asyn
c triggerBulkAction() {\n const selectedUsers = [...document.querySelectorAll(Selectors.selectBulkItemCheckbox)].map(checkbox => checkbox.value);\n\n const modal = await DeleteCancelModal.create({\n title: await getString('removesubmission', 'mod_assign'),\n buttons: {\n save: await getString('batchoperationremovesubmission', 'mod_assign'),\n },\n body: Templates.render('mod_assign/bulkactions/grading/bulk_action_modal_body', {\n text: await getString('batchoperationconfirmremovesubmission', 'mod_assign'),\n operation: 'removesubmission',\n cmid: this.#cmid,\n selectedusers: selectedUsers.join(','),\n sesskey: this.#sesskey\n }),\n show: true,\n removeOnClose: true,\n });\n\n // Handle delete event.\n modal.getRoot().on(ModalEvents.delete, (e) => {\n e.preventDefault();\n modal.getRoot().
find('form').submit();\n });\n }\n\n async renderBulkActionTrigger(showInDropdown, index) {\n return Templates.render('mod_assign/bulkactions/grading/bulk_delete_trigger', {\n showindropdown: showInDropdown,\n isfirst: index === 0,\n });\n }\n}\n"],"names":["Selectors","BulkAction","constructor","cmid","sesskey","getBulkActionTriggerSelector","selectedUsers","document","querySelectorAll","map","checkbox","value","modal","DeleteCancelModal","create","title","buttons","save","body","Templates","render","text","operation","this","selectedusers","join","show","removeOnClose","getRoot","on","ModalEvents","delete","e","preventDefault","find","submit","showInDropdown","index","showindropdown","isfirst"],"mappings":"uoDA6BMA,iCACsB,yHAGCC,qBAazBC,YAAYC,KAAMC,yLAEDD,0CACGC,SAGpBC,qCACW,6FAIDC,cAAgB,IAAIC,SAASC,iBAAiBR,mCAAmCS,KAAIC,UAAYA,SAASC,QAE1GC,YAAcC,6BAAkBC,OAAO,CACzCC,YAAa,kBAAU,mBAAoB,cAC3CC,QAAS,CACLC,WAAY,kBAAU,iCAAkC,eAE5DC,KAAMC,mBAAUC,OAAO,wDAAyD,CAC5E
C,WAAY,kBAAU,wCAAyC,cAC/DC,UAAW,mBACXnB,2BAAMoB,YACNC,cAAelB,cAAcmB,KAAK,KAClCrB,8BAASmB,iBAEbG,MAAM,EACNC,eAAe,IAInBf,MAAMgB,UAAUC,GAAGC,sBAAYC,QAASC,IACpCA,EAAEC,iBACFrB,MAAMgB,UAAUM,KAAK,QAAQC,0CAIPC,eAAgBC,cACnClB,mBAAUC,OAAO,qDAAsD,CAC1EkB,eAAgBF,eAChBG,QAAmB,IAAVF"}