{"version":3,"file":"modal_delete.min.js","sources":["http:\/\/www.eb23caiderei.pt\/moodle\/calendar\/amd\/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 .\n\n\/**\n * Contain the logic for the delete modal.\n *\n * @module core_calendar\/modal_delete\n * @copyright 2017 Andrew Nicols \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\ndefine([\n 'jquery',\n 'core\/notification',\n 'core\/custom_interaction_events',\n 'core\/modal',\n 'core\/modal_events',\n 'core\/modal_registry',\n 'core_calendar\/events',\n],\nfunction(\n $,\n Notification,\n CustomEvents,\n Modal,\n ModalEvents,\n ModalRegistry,\n CalendarEvents\n) {\n\n var registered = false;\n var 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 *\/\n var ModalDelete = function(root) {\n Modal.call(this, root);\n\n this.setRemoveOnClose(true);\n };\n\n ModalDelete.TYPE = 'core_calendar-modal_delete';\n ModalDelete.prototype = Object.create(Modal.prototype);\n ModalDelete.prototype.constructor = ModalDelete;\n\n \/**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n *\/\n ModalDelete.prototype.registerEventListeners = function() {\n \/\/ Apply parent event listeners.\n Modal.prototype.registerEventListeners.call(this);\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.DELETE_ONE_BUTTON, function(e, data) {\n var saveEvent = $.Event(ModalEvents.save);\n this.getRoot().trigger(saveEvent, this);\n\n if (!saveEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n }.bind(this));\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.DELETE_ALL_BUTTON, function(e, data) {\n var saveEvent = $.Event(CalendarEvents.deleteAll);\n this.getRoot().trigger(saveEvent, this);\n\n if (!saveEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n }.bind(this));\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.CANCEL_BUTTON, function(e, data) {\n var cancelEvent = $.Event(ModalEvents.cancel);\n this.getRoot().trigger(cancelEvent, this);\n\n if (!cancelEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n }.bind(this));\n };\n\n \/\/ Automatically register with the modal registry the first time this module is imported so that you can create modals\n \/\/ of this type using the modal factory.\n if (!registered) {\n ModalRegistry.register(ModalDelete.TYPE, ModalDelete, 'calendar\/event_delete_modal');\n registered = true;\n }\n\n return ModalDelete;\n});\n"],"names":["define","$","Notification","CustomEvents","Modal","ModalEvents","ModalRegistry","CalendarEvents","registered","SELECTORS","ModalDelete","root","call","this","setRemoveOnClose","TYPE","prototype","Object","create","constructor","registerEventListeners","getModal","on","events","activate","e","data","saveEvent","Event","save","getRoot","trigger","isDefaultPrevented","hide","originalEvent","preventDefault","bind","deleteAll","cancelEvent","cancel","register"],"mappings":";;;;;;;AAsBAA,oCAAO,CACH,SACA,oBACA,iCACA,aACA,oBACA,sBACA,yBAEJ,SACIC,EACAC,aACAC,aACAC,MACAC,YACAC,cACAC,oBAGIC,YAAa,EACbC,4BACmB,4BADnBA,4BAEmB,4BAFnBA,wBAGe,yBASfC,YAAc,SAASC,MACvBP,MAAMQ,KAAKC,KAAMF,WAEZG,kBAAiB,WAG1BJ,YAAYK,KAAO,8BACnBL,YAAYM,UAAYC,OAAOC,OAAOd,MAAMY,YACtBG,YAAcT,YAOpCA,YAAYM,UAAUI,uBAAyB,WAE3ChB,MAAMY,UAAUI,uBAAuBR,KAAKC,WAEvCQ,WAAWC,GAAGnB,aAAaoB,OAAOC,SAAUf,4BAA6B,SAASgB,EAAGC,UAClFC,UAAY1B,EAAE2B,MAAMvB,YAAYwB,WAC\/BC,UAAUC,QAAQJ,UAAWd,MAE7Bc,UAAUK,4BACNC,OACLP,KAAKQ,cAAcC,mBAEzBC,KAAKvB,YAEFQ,WAAWC,GAAGnB,aAAaoB,OAAOC,SAAUf,4BAA6B,SAASgB,EAAGC,UAClFC,UAAY1B,EAAE2B,MAAMrB,eAAe8B,gBAClCP,UAAUC,QAAQJ,UAAWd,MAE7Bc,UAAUK,4BACNC,OACLP,KAAKQ,cAAcC,mBAEzBC,KAAKvB,YAEFQ,WAAWC,GAAGnB,aAAaoB,OAAOC,SAAUf,wBAAyB,SAASgB,EAAGC,UAC9EY,YAAcrC,EAAE2B,MAAMvB,YAAYkC,aACjCT,UAAUC,QAAQO,YAAazB,MAE\/ByB,YAAYN,4BACRC,OACLP,KAAKQ,cAAcC,mBAEzBC,KAAKvB,QAKNL,aACDF,cAAckC,SAAS9B,YAAYK,KAAML,YAAa,+BACtDF,YAAa,GAGVE"}