Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/calendar/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/calendar/amd/build/summary_modal.min.js.map

{"version":3,"sources":["../src/summary_modal.js"],"names":["define","$","Str","Notification","CustomEvents","Modal","ModalRegistry","ModalFactory","ModalEvents","CalendarRepository","CalendarEvents","CalendarCrud","registered","SELECTORS","ROOT","EDIT_BUTTON","DELETE_BUTTON","ModalEventSummary","root","call","TYPE","prototype","Object","create","constructor","getEditButton","editButton","getFooter","find","getDeleteButton","deleteButton","getEventId","getBody","attr","getEventTitle","getEventCount","getEditUrl","isActionEvent","registerEventListeners","M","util","js_pending","getRoot","on","bodyRendered","getModal","data","eventTitle","eventId","eventCount","registerRemove","js_complete","bind","deleted","hide","events","activate","e","trigger","editActionEvent","editEvent","preventDefault","stopPropagation","originalEvent","register"],"mappings":"AAuBAA,OAAM,+BAAC,CACH,QADG,CAEH,UAFG,CAGH,mBAHG,CAIH,gCAJG,CAKH,YALG,CAMH,qBANG,CAOH,oBAPG,CAQH,mBARG,CASH,0BATG,CAUH,sBAVG,CAWH,oBAXG,CAAD,CAaN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYE,IAEMC,CAAAA,CAAU,GAFhB,CAGMC,CAAS,CAAG,CACZC,IAAI,CAAE,yCADM,CAEZC,WAAW,CAAE,wBAFD,CAGZC,aAAa,CAAE,0BAHH,CAHlB,CAcMC,CAAiB,CAAG,SAASC,CAAT,CAAe,CACnCb,CAAK,CAACc,IAAN,CAAW,IAAX,CAAiBD,CAAjB,CACH,CAhBH,CAkBED,CAAiB,CAACG,IAAlB,CAAyB,6BAAzB,CACAH,CAAiB,CAACI,SAAlB,CAA8BC,MAAM,CAACC,MAAP,CAAclB,CAAK,CAACgB,SAApB,CAA9B,CACA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c,CAACiD,eAAjC,CAAkD,CAAC,KAAKvB,UAAL,EAAD,CAAlD,CACH,CAHD,IAGO,CAGHnC,CAAC,CAAC,MAAD,CAAD,CAAUyD,OAAV,CAAkBhD,CAAc,CAACkD,SAAjC,CAA4C,CAAC,KAAK7B,UAAL,EAAD,CAA5C,CACH,CAGD,KAAKuB,IAAL,GAGAG,CAAC,CAACI,cAAF,GACAJ,CAAC,CAACK,eAAF,GACAhB,CAAI,CAACiB,aAAL,CAAmBF,cAAnB,GACAf,CAAI,CAACiB,aAAL,CAAmBD,eAAnB,EACH,CAlBqD,CAkBpDV,IAlBoD,CAkB/C,IAlB+C,CAAtD,CAmBH,CA9CD,CAkDA,GAAI,CAACxC,CAAL,CAAiB,CACbN,CAAa,CAAC0D,QAAd,CAAuB/C,CAAiB,CAACG,IAAzC,CAA+CH,CAA/C,CAAkE,mCAAlE,EACAL,CAAU,GACb,CAED,MAAOK,CAAAA,CACV,CAlMK,CAAN","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 * A javascript module to handle summary modal.\n *\n * @module     core_calendar/summary_modal\n * @package    core_calendar\n * @copyright  2017 Simey Lameze <simey@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n    'jquery',\n    'core/str',\n    'core/notification',\n    'core/custom_interaction_events',\n    'core/modal',\n    'core/modal_registry',\n    'core/modal_factory',\n    'core/modal_events',\n    'core_calendar/repository',\n    'core_calendar/events',\n    'core_calendar/crud',\n],\nfunction(\n    $,\n    Str,\n    Notification,\n    CustomEvents,\n    Modal,\n    ModalRegistry,\n    ModalFactory,\n    ModalEvents,\n    CalendarRepository,\n    CalendarEvents,\n    CalendarCrud\n) {\n\n    var registered = false;\n    var SELECTORS = {\n        ROOT: \"[data-region='summary-modal-container']\",\n        EDIT_BUTTON: '[data-action=\"edit\"]',\n        DELETE_BUTTON: '[data-action=\"delete\"]',\n    };\n\n    /**\n     * Constructor for the Modal.\n     *\n     * @param {object} root The root jQuery element for the modal\n     */\n    var ModalEventSummary = function(root) {\n        Modal.call(this, root);\n    };\n\n    ModalEventSummary.TYPE = 'core_calendar-event_summary';\n    ModalEventSummary.prototype = Object.create(Modal.prototype);\n    ModalEventSummary.prototype.constructor = ModalEventSummary;\n\n    /**\n     * Get the edit button element from the footer. The button is cached\n     * as it's not expected to change.\n     *\n     * @method getEditButton\n     * @return {object} button element\n     */\n    ModalEventSummary.prototype.getEditButton = function() {\n        if (typeof this.editButton == 'undefined') {\n            this.editButton = this.getFooter().find(SELECTORS.EDIT_BUTTON);\n        }\n\n        return this.editButton;\n    };\n\n    /**\n     * Get the delete button element from the footer. The button is cached\n     * as it's not expected to change.\n     *\n     * @method getDeleteButton\n     * @return {object} button element\n     */\n    ModalEventSummary.prototype.getDeleteButton = function() {\n        if (typeof this.deleteButton == 'undefined') {\n            this.deleteButton = this.getFooter().find(SELECTORS.DELETE_BUTTON);\n        }\n\n        return this.deleteButton;\n    };\n\n    /**\n     * Get the id for the event being shown in this modal. This value is\n     * not cached because it will change depending on which event is\n     * being displayed.\n     *\n     * @method getEventId\n     * @return {int}\n     */\n    ModalEventSummary.prototype.getEventId = function() {\n        return this.getBody().find(SELECTORS.ROOT).attr('data-event-id');\n    };\n\n    /**\n     * Get the title for the event being shown in this modal. This value is\n     * not cached because it will change depending on which event is\n     * being displayed.\n     *\n     * @method getEventTitle\n     * @return {String}\n     */\n    ModalEventSummary.prototype.getEventTitle = function() {\n        return this.getBody().find(SELECTORS.ROOT).attr('data-event-title');\n    };\n\n    /**\n     * Get the number of events in the series for the event being shown in\n     * this modal. This value is not cached because it will change\n     * depending on which event is being displayed.\n     *\n     * @method getEventCount\n     * @return {int}\n     */\n    ModalEventSummary.prototype.getEventCount = function() {\n        return this.getBody().find(SELECTORS.ROOT).attr('data-event-count');\n    };\n\n    /**\n     * Get the url for the event being shown in this modal.\n     *\n     * @method getEventUrl\n     * @return {String}\n     */\n    ModalEventSummary.prototype.getEditUrl = function() {\n        return this.getBody().find(SELECTORS.ROOT).attr('data-edit-url');\n    };\n\n    /**\n     * Is this an action event.\n     *\n     * @method getEventUrl\n     * @return {String}\n     */\n    ModalEventSummary.prototype.isActionEvent = function() {\n        return (this.getBody().find(SELECTORS.ROOT).attr('data-action-event') == 'true');\n    };\n\n    /**\n     * Set up all of the event handling for the modal.\n     *\n     * @method registerEventListeners\n     */\n    ModalEventSummary.prototype.registerEventListeners = function() {\n        // Apply parent event listeners.\n        Modal.prototype.registerEventListeners.call(this);\n\n        // We have to wait for the modal to finish rendering in order to ensure that\n        // the data-event-title property is available to use as the modal title.\n        M.util.js_pending('core_calendar/summary_modal:registerEventListeners:bodyRendered');\n        this.getRoot().on(ModalEvents.bodyRendered, function() {\n            this.getModal().data({\n                eventTitle: this.getEventTitle(),\n                eventId: this.getEventId(),\n                eventCount: this.getEventCount(),\n            })\n            .attr('data-type', 'event');\n            CalendarCrud.registerRemove(this.getModal());\n            M.util.js_complete('core_calendar/summary_modal:registerEventListeners:bodyRendered');\n        }.bind(this));\n\n        $('body').on(CalendarEvents.deleted, function() {\n            // Close the dialogue on delete.\n            this.hide();\n        }.bind(this));\n\n        CustomEvents.define(this.getEditButton(), [\n            CustomEvents.events.activate\n        ]);\n\n        this.getEditButton().on(CustomEvents.events.activate, function(e, data) {\n            if (this.isActionEvent()) {\n                // Action events cannot be edited on the event form and must be redirected to the module UI.\n                $('body').trigger(CalendarEvents.editActionEvent, [this.getEditUrl()]);\n            } else {\n                // When the edit button is clicked we fire an event for the calendar UI to handle.\n                // We don't care how the UI chooses to handle it.\n                $('body').trigger(CalendarEvents.editEvent, [this.getEventId()]);\n            }\n\n            // There is nothing else for us to do so let's hide.\n            this.hide();\n\n            // We've handled this event so no need to propagate it.\n            e.preventDefault();\n            e.stopPropagation();\n            data.originalEvent.preventDefault();\n            data.originalEvent.stopPropagation();\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(ModalEventSummary.TYPE, ModalEventSummary, 'core_calendar/event_summary_modal');\n        registered = true;\n    }\n\n    return ModalEventSummary;\n});\n"],"file":"summary_modal.min.js"}