Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"policymodal.min.js","sources":["../src/policymodal.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\nimport Modal from 'core/modal';\nimport Policy from './policy';\nimport CustomEvents from 'core/custom_interaction_events';\n\n/**\n * The Javascript module to handle the policy modal.\n *\n * @module     core_ai/policymodal\n * @copyright  Andrew Lyons <andrew@nicols.co.uk>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nexport default class PolicyModal extends Modal {\n    static TYPE = 'core_ai/policymodal';\n    static TEMPLATE = 'core_ai/policymodal';\n\n    /**\n     * Configure the modal.\n     *\n     * @param {object} modalConfig The modal configuration.\n     */\n    configure(modalConfig) {\n        super.configure({\n            ...modalConfig,\n            show: true,\n            removeOnClose: true,\n        });\n\n        this.context = modalConfig.context;\n        this.setXlarge();\n    }\n\n    /**\n     * Set the modal to be extra large.\n     */\n    setXlarge() {\n        this.getModal().addClass('modal-xl');\n    }\n\n    /**\n     * Handle click events within the policy modal.\n     */\n    registerEventListeners() {\n        super.registerEventListeners();\n        this.registerCloseOnSave();\n        this.registerCloseOnCancel();\n\n        this.getModal().on(CustomEvents.events.activate, this.getActionSelector('save'), (e) => {\n            e.preventDefault();\n            Policy.acceptPolicy();\n        });\n    }\n}\n"],"names":["PolicyModal","Modal","configure","modalConfig","show","removeOnClose","context","setXlarge","getModal","addClass","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","on","CustomEvents","events","activate","this","getActionSelector","e","preventDefault","acceptPolicy"],"mappings":";;;;;;;uPA0BqBA,oBAAoBC,eASrCC,UAAUC,mBACAD,UAAU,IACTC,YACHC,MAAM,EACNC,eAAe,SAGdC,QAAUH,YAAYG,aACtBC,YAMTA,iBACSC,WAAWC,SAAS,YAM7BC,+BACUA,8BACDC,2BACAC,6BAEAJ,WAAWK,GAAGC,mCAAaC,OAAOC,SAAUC,KAAKC,kBAAkB,SAAUC,IAC9EA,EAAEC,iCACKC,uEArCErB,mBACH,uCADGA,uBAEC"}