Proyectos de Subversion Moodle

Rev

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

{"version":3,"file":"data_request_modal.min.js","sources":["../src/data_request_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 <http://www.gnu.org/licenses/>.\n\n/**\n * Request actions.\n *\n * @module     tool_dataprivacy/data_request_modal\n * @copyright  2018 Jun Pataleta\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport * as CustomEvents from 'core/custom_interaction_events';\nimport Modal from 'core/modal';\nimport DataPrivacyEvents from './events';\n\nconst SELECTORS = {\n    APPROVE_BUTTON: '[data-action=\"approve\"]',\n    DENY_BUTTON: '[data-action=\"deny\"]',\n    COMPLETE_BUTTON: '[data-action=\"complete\"]',\n    APPROVE_REQUEST_SELECT_COURSE: '[data-action=\"approve-selected-courses\"]',\n};\n\nexport default class ModalDataRequest extends Modal {\n    static TYPE = 'tool_dataprivacy-data_request';\n    static TEMPLATE = 'tool_dataprivacy/data_request_modal';\n\n    /**\n     * Set up all of the event handling for the modal.\n     */\n    registerEventListeners() {\n        // Apply parent event listeners.\n        super.registerEventListeners(this);\n\n        this.getModal().on(CustomEvents.events.activate, SELECTORS.APPROVE_BUTTON, (e, data) => {\n            const approveEvent = $.Event(DataPrivacyEvents.approve);\n            this.getRoot().trigger(approveEvent, this);\n\n            if (!approveEvent.isDefaultPrevented()) {\n                this.hide();\n                data.originalEvent.preventDefault();\n            }\n        });\n\n        this.getModal().on(CustomEvents.events.activate, SELECTORS.DENY_BUTTON, (e, data) => {\n            const denyEvent = $.Event(DataPrivacyEvents.deny);\n            this.getRoot().trigger(denyEvent, this);\n\n            if (!denyEvent.isDefaultPrevented()) {\n                this.hide();\n                data.originalEvent.preventDefault();\n            }\n        });\n\n        this.getModal().on(CustomEvents.events.activate, SELECTORS.COMPLETE_BUTTON, (e, data) => {\n            const completeEvent = $.Event(DataPrivacyEvents.complete);\n            this.getRoot().trigger(completeEvent, this);\n\n            if (!completeEvent.isDefaultPrevented()) {\n                this.hide();\n                data.originalEvent.preventDefault();\n            }\n        });\n\n        this.getModal().on(CustomEvents.events.activate, SELECTORS.APPROVE_REQUEST_SELECT_COURSE, (e, data) => {\n            let approveSelectCoursesEvent = $.Event(DataPrivacyEvents.approveSelectCourses);\n            this.getRoot().trigger(approveSelectCoursesEvent, this);\n\n            if (!approveSelectCoursesEvent.isDefaultPrevented()) {\n                this.hide();\n                data.originalEvent.preventDefault();\n            }\n        });\n\n    }\n}\n\nModalDataRequest.registerModalType();\n"],"names":["SELECTORS","ModalDataRequest","Modal","registerEventListeners","this","getModal","on","CustomEvents","events","activate","e","data","approveEvent","$","Event","DataPrivacyEvents","approve","getRoot","trigger","isDefaultPrevented","hide","originalEvent","preventDefault","denyEvent","deny","completeEvent","complete","approveSelectCoursesEvent","approveSelectCourses","registerModalType"],"mappings":"gjDA4BMA,yBACc,0BADdA,sBAEW,uBAFXA,0BAGe,2BAHfA,wCAI6B,iDAGdC,yBAAyBC,eAO1CC,+BAEUA,uBAAuBC,WAExBC,WAAWC,GAAGC,aAAaC,OAAOC,SAAUT,0BAA0B,CAACU,EAAGC,cACrEC,aAAeC,gBAAEC,MAAMC,gBAAkBC,cAC1CC,UAAUC,QAAQN,aAAcR,MAEhCQ,aAAaO,4BACTC,OACLT,KAAKU,cAAcC,0BAItBjB,WAAWC,GAAGC,aAAaC,OAAOC,SAAUT,uBAAuB,CAACU,EAAGC,cAClEY,UAAYV,gBAAEC,MAAMC,gBAAkBS,WACvCP,UAAUC,QAAQK,UAAWnB,MAE7BmB,UAAUJ,4BACNC,OACLT,KAAKU,cAAcC,0BAItBjB,WAAWC,GAAGC,aAAaC,OAAOC,SAAUT,2BAA2B,CAACU,EAAGC,cACtEc,cAAgBZ,gBAAEC,MAAMC,gBAAkBW,eAC3CT,UAAUC,QAAQO,cAAerB,MAEjCqB,cAAcN,4BACVC,OACLT,KAAKU,cAAcC,0BAItBjB,WAAWC,GAAGC,aAAaC,OAAOC,SAAUT,yCAAyC,CAACU,EAAGC,YACtFgB,0BAA4Bd,gBAAEC,MAAMC,gBAAkBa,2BACrDX,UAAUC,QAAQS,0BAA2BvB,MAE7CuB,0BAA0BR,4BACtBC,OACLT,KAAKU,cAAcC,+EA/CdrB,wBACH,iDADGA,4BAEC,uCAoDtBA,iBAAiB4B"}