AutorÃa | Ultima modificación | Ver Log |
{"version":3,"file":"participants.min.js","sources":["../src/participants.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 * Some UI stuff for participants page.\n * This is also used by the report/participants/index.php because it has the same functionality.\n *\n * @module report_participation/participants\n * @copyright 2017 Damyon W
iese\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport jQuery from 'jquery';\nimport CustomEvents from 'core/custom_interaction_events';\nimport ModalEvents from 'core/modal_events';\nimport Notification from 'core/notification';\nimport {showSendMessage} from 'core_user/local/participants/bulkactions';\n\nconst Selectors = {\n bulkActionSelect: \"#formactionid\",\n bulkUserSelectedCheckBoxes: \"input[data-togglegroup^='participants-table'][data-toggle='slave']:checked\",\n participantsForm: '#participantsform',\n};\n\nexport const init = () => {\n const root = document.querySelector(Selectors.participantsForm);\n\n /**\n * Private method.\n *\n * @method registerEventListeners\n * @private\n */\n const registerEventListeners = () => {\n CustomEvents.define(Selectors.bulkActionSelect, [CustomEvents.events.accessibleChange]);\n jQuery(Selectors.bulkActionSelect).on(CustomEvents.events.accessibleChange, e => {\n
const action = e.target.value;\n const checkboxes = root.querySelectorAll(Selectors.bulkUserSelectedCheckBoxes);\n\n if (action.indexOf('#') !== -1) {\n e.preventDefault();\n\n const ids = [];\n checkboxes.forEach(checkbox => {\n ids.push(checkbox.getAttribute('name').replace('user', ''));\n });\n\n if (action === '#messageselect') {\n showSendMessage(ids)\n .then(modal => {\n modal.getRoot().on(ModalEvents.hidden, () => {\n // Focus on the action select when the dialog is closed.\n const bulkActionSelector = root.querySelector(Selectors.bulkActionSelect);\n resetBulkAction(bulkActionSelector);\n bulkActionSelector.focus();\n });\n\n return modal;\n })\n
.catch(Notification.exception);\n }\n } else if (action !== '' && checkboxes.length) {\n e.target.form().submit();\n }\n\n resetBulkAction(e.target);\n });\n };\n\n const resetBulkAction = bulkActionSelect => {\n bulkActionSelect.value = '';\n };\n\n registerEventListeners();\n};\n"],"names":["Selectors","root","document","querySelector","resetBulkAction","bulkActionSelect","value","define","CustomEvents","events","accessibleChange","on","e","action","target","checkboxes","querySelectorAll","indexOf","preventDefault","ids","forEach","checkbox","push","getAttribute","replace","then","modal","getRoot","ModalEvents","hidden","bulkActionSelector","focus","catch","Notification","exception","length","form","submit"],"mappings":";;;;;;;;sTA8BMA,2BACgB,gBADhBA,qCAE0B,6EAF1BA,2BAGgB,kCAGF,WACVC,KAAOC,SAASC,cAAcH,4BA4C9BI,gBAAkBC,mBACpBA,iBAAiBC,MAAQ,uCApCZC,OAAOP,2BAA4B,CAACQ,mCAAaC,OAAOC,uCAC9DV,4BAA4BW,GAAGH,mCAAaC,O
AAOC,kBAAkBE,UAClEC,OAASD,EAAEE,OAAOR,MAClBS,WAAad,KAAKe,iBAAiBhB,0CAEZ,IAAzBa,OAAOI,QAAQ,KAAa,CAC5BL,EAAEM,uBAEIC,IAAM,GACZJ,WAAWK,SAAQC,WACfF,IAAIG,KAAKD,SAASE,aAAa,QAAQC,QAAQ,OAAQ,QAG5C,mBAAXX,yCACgBM,KACfM,MAAKC,QACFA,MAAMC,UAAUhB,GAAGiB,sBAAYC,QAAQ,WAE7BC,mBAAqB7B,KAAKE,cAAcH,4BAC9CI,gBAAgB0B,oBAChBA,mBAAmBC,WAGhBL,SAEVM,MAAMC,sBAAaC,eAEN,KAAXrB,QAAiBE,WAAWoB,QACnCvB,EAAEE,OAAOsB,OAAOC,SAGpBjC,gBAAgBQ,EAAEE"}