mirror of
https://github.com/moodle/moodle.git
synced 2025-03-06 08:49:53 +01:00
Once MDL-64554 landed, content bank can implement the original proposal, using a modal form when uploading files.
1 line
3.0 KiB
Plaintext
1 line
3.0 KiB
Plaintext
{"version":3,"sources":["../src/upload.js"],"names":["initModal","elementSelector","formClass","contextId","contentId","element","document","querySelector","addEventListener","e","preventDefault","form","ModalForm","args","contextid","id","modalConfig","title","returnFocus","target","events","FORM_SUBMITTED","event","location","detail","returnurl","show"],"mappings":"gLAsBA,uD,YAWyB,QAAZA,CAAAA,SAAY,CAACC,CAAD,CAAkBC,CAAlB,CAA6BC,CAA7B,CAAwCC,CAAxC,CAAsD,CAC3E,GAAMC,CAAAA,CAAO,CAAGC,QAAQ,CAACC,aAAT,CAAuBN,CAAvB,CAAhB,CACAI,CAAO,CAACG,gBAAR,CAAyB,OAAzB,CAAkC,SAASC,CAAT,CAAY,CAC1CA,CAAC,CAACC,cAAF,GACA,GAAMC,CAAAA,CAAI,CAAG,GAAIC,UAAJ,CAAc,CACvBV,SAAS,CAATA,CADuB,CAEvBW,IAAI,CAAE,CACFC,SAAS,CAAEX,CADT,CAEFY,EAAE,CAAEX,CAFF,CAFiB,CAMvBY,WAAW,CAAE,CAACC,KAAK,CAAE,iBAAU,QAAV,CAAoB,aAApB,CAAR,CANU,CAOvBC,WAAW,CAAET,CAAC,CAACU,MAPQ,CAAd,CAAb,CASAR,CAAI,CAACH,gBAAL,CAAsBG,CAAI,CAACS,MAAL,CAAYC,cAAlC,CAAkD,SAACC,CAAD,CAAW,CACzDhB,QAAQ,CAACiB,QAAT,CAAoBD,CAAK,CAACE,MAAN,CAAaC,SACpC,CAFD,EAGAd,CAAI,CAACe,IAAL,EACH,CAfD,CAgBH,C","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 * Module to handle AJAX interactions with content bank upload files.\n *\n * @module core_contentbank/upload\n * @copyright 2021 Sara Arjona <sara@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport ModalForm from 'core_form/modalform';\nimport {get_string as getString} from 'core/str';\n\n/**\n * Initialize upload files to the content bank form as Modal form.\n *\n * @param {String} elementSelector\n * @param {String} formClass\n * @param {Integer} contextId\n * @param {Integer} contentId\n */\nexport const initModal = (elementSelector, formClass, contextId, contentId) => {\n const element = document.querySelector(elementSelector);\n element.addEventListener('click', function(e) {\n e.preventDefault();\n const form = new ModalForm({\n formClass,\n args: {\n contextid: contextId,\n id: contentId,\n },\n modalConfig: {title: getString('upload', 'contentbank')},\n returnFocus: e.target,\n });\n form.addEventListener(form.events.FORM_SUBMITTED, (event) => {\n document.location = event.detail.returnurl;\n });\n form.show();\n });\n};\n"],"file":"upload.min.js"} |