AutorÃa | Ultima modificación | Ver Log |
{"version":3,"file":"modal_delete.min.js","sources":["../src/modal_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 * Contain the logic for the delete modal.\n *\n * @module core_calendar/modal_delete\n * @copyright 2017 Andrew Nicols <andrew@nicols.co.uk>\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 ModalEvents from 'core/modal_events';\nimport CalendarEvents from './events';\n\nconst SELECTORS = {\n DELETE_ONE_BUTTON: '[data-action=\"deleteone\"]',\n DELETE_ALL_BUTTON: '[data-action=\"deleteall\"]',\n CANCEL_BUTTON: '[data-action=\"cancel\"]',\n};\n\n/**\n * Constructor for the Modal.\n *\n * @class\n * @param {object} root The root jQuery element for the modal\n */\nexport default class ModalDelete extends Modal {\n static TYPE = 'core_calendar-modal_delete';\n static TEMPLATE = 'calendar/event_delete_modal';\n\n constructor(root) {\n super(root);\n this.setRemoveOnClose(true);\n }\n\n /**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n */\n registerEventListeners() {\n // Apply parent event listeners.\n super.registerEventListeners(this);\n\n th
is.getModal().on(CustomEvents.events.activate, SELECTORS.DELETE_ONE_BUTTON, (e, data) => {\n const saveEvent = $.Event(ModalEvents.save);\n this.getRoot().trigger(saveEvent, this);\n\n if (!saveEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n });\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.DELETE_ALL_BUTTON, (e, data) => {\n const saveEvent = $.Event(CalendarEvents.deleteAll);\n this.getRoot().trigger(saveEvent, this);\n\n if (!saveEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n });\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.CANCEL_BUTTON, (e, data) => {\n const cancelEvent = $.Event(ModalEvents.cancel);\n this.getRoot().trigger(cancelEvent, this);\n\n if (!cancelEvent.isDefaultPreve
nted()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n });\n }\n}\n\nModalDelete.registerModalType();\n"],"names":["SELECTORS","ModalDelete","Modal","constructor","root","setRemoveOnClose","registerEventListeners","this","getModal","on","CustomEvents","events","activate","e","data","saveEvent","$","Event","ModalEvents","save","getRoot","trigger","isDefaultPrevented","hide","originalEvent","preventDefault","CalendarEvents","deleteAll","cancelEvent","cancel","registerModalType"],"mappings":"6nDA6BMA,4BACiB,4BADjBA,4BAEiB,4BAFjBA,wBAGa,+BASEC,oBAAoBC,eAIrCC,YAAYC,YACFA,WACDC,kBAAiB,GAQ1BC,+BAEUA,uBAAuBC,WAExBC,WAAWC,GAAGC,aAAaC,OAAOC,SAAUZ,6BAA6B,CAACa,EAAGC,cACxEC,UAAYC,gBAAEC,MAAMC,sBAAYC,WACjCC,UAAUC,QAAQN,UAAWR,MAE7BQ,UAAUO,4BACNC,OACLT,KAAKU,cAAcC,0BAItBjB,WAAWC,GAAGC,aAAaC,OAAOC,SAAUZ,6BAA6B,CAACa,EAAGC,cACxEC,UAAYC,gBAAEC,MAAMS,gBAAeC,gBACpCP,UAAUC,QAAQN,UAAWR,MAE7BQ,UAAUO,4BACNC,OACLT,KAAKU,cAAcC,0BAItBjB,WAAWC,GAAGC,aAAaC,OAAOC,SAAUZ,yBA
AyB,CAACa,EAAGC,cACpEc,YAAcZ,gBAAEC,MAAMC,sBAAYW,aACnCT,UAAUC,QAAQO,YAAarB,MAE/BqB,YAAYN,4BACRC,OACLT,KAAKU,cAAcC,0EA5CdxB,mBACH,8CADGA,uBAEC,+BAgDtBA,YAAY6B"}