%PDF- %PDF-
Direktori : /home/vacivi36/ava/admin/tool/policy/amd/build/ |
Current File : /home/vacivi36/ava/admin/tool/policy/amd/build/policyactions.min.js.map |
{"version":3,"file":"policyactions.min.js","sources":["../src/policyactions.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 * Policy actions.\n *\n * @module tool_policy/policyactions\n * @copyright 2018 Sara Arjona (sara@moodle.com)\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/ajax',\n 'core/notification',\n 'core/modal_factory',\n 'core/modal_events'],\nfunction($, Ajax, Notification, ModalFactory, ModalEvents) {\n\n /**\n * PolicyActions class.\n *\n * @param {jQuery} root\n */\n var PolicyActions = function(root) {\n this.registerEvents(root);\n };\n\n /**\n * Register event listeners.\n *\n * @param {jQuery} root\n */\n PolicyActions.prototype.registerEvents = function(root) {\n root.on(\"click\", function(e) {\n e.preventDefault();\n\n var versionid = $(this).data('versionid');\n var behalfid = $(this).data('behalfid');\n\n var params = {\n 'versionid': versionid,\n 'behalfid': behalfid\n };\n\n var request = {\n methodname: 'tool_policy_get_policy_version',\n args: params\n };\n\n var modalTitle = $.Deferred();\n var modalBody = $.Deferred();\n\n var modal = ModalFactory.create({\n title: modalTitle,\n body: modalBody,\n large: true\n })\n .then(function(modal) {\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Destroy when hidden.\n modal.destroy();\n });\n\n return modal;\n })\n .then(function(modal) {\n modal.show();\n\n return modal;\n })\n .catch(Notification.exception);\n\n // Make the request now that the modal is configured.\n var promises = Ajax.call([request]);\n $.when(promises[0]).then(function(data) {\n if (data.result.policy) {\n modalTitle.resolve(data.result.policy.name);\n modalBody.resolve(data.result.policy.content);\n\n return data;\n } else {\n throw new Error(data.warnings[0].message);\n }\n }).catch(function(message) {\n modal.then(function(modal) {\n modal.hide();\n modal.destroy();\n\n return modal;\n })\n .catch(Notification.exception);\n\n return Notification.addNotification({\n message: message,\n type: 'error'\n });\n });\n });\n\n };\n\n return /** @alias module:tool_policy/policyactions */ {\n // Public variables and functions.\n\n /**\n * Initialise the actions helper.\n *\n * @method init\n * @param {object} root\n * @return {PolicyActions}\n */\n 'init': function(root) {\n root = $(root);\n return new PolicyActions(root);\n }\n };\n});\n"],"names":["define","$","Ajax","Notification","ModalFactory","ModalEvents","PolicyActions","root","registerEvents","prototype","on","e","preventDefault","request","methodname","args","this","data","modalTitle","Deferred","modalBody","modal","create","title","body","large","then","getRoot","hidden","destroy","show","catch","exception","promises","call","when","result","policy","resolve","name","content","Error","warnings","message","hide","addNotification","type"],"mappings":";;;;;;;AAsBAA,mCAAO,CACH,SACA,YACA,oBACA,qBACA,sBACJ,SAASC,EAAGC,KAAMC,aAAcC,aAAcC,iBAOtCC,cAAgB,SAASC,WACpBC,eAAeD,cAQxBD,cAAcG,UAAUD,eAAiB,SAASD,MAC9CA,KAAKG,GAAG,SAAS,SAASC,GACtBA,EAAEC,qBAUEC,QAAU,CACVC,WAAY,iCACZC,KAPS,WAHGd,EAAEe,MAAMC,KAAK,sBACdhB,EAAEe,MAAMC,KAAK,cAYxBC,WAAajB,EAAEkB,WACfC,UAAYnB,EAAEkB,WAEdE,MAAQjB,aAAakB,OAAO,CAC5BC,MAAOL,WACPM,KAAMJ,UACNK,OAAO,IAEVC,MAAK,SAASL,cAEXA,MAAMM,UAAUjB,GAAGL,YAAYuB,QAAQ,WAEnCP,MAAMQ,aAGHR,SAEVK,MAAK,SAASL,cACXA,MAAMS,OAECT,SAEVU,MAAM5B,aAAa6B,WAGhBC,SAAW/B,KAAKgC,KAAK,CAACrB,UAC1BZ,EAAEkC,KAAKF,SAAS,IAAIP,MAAK,SAAST,SAC1BA,KAAKmB,OAAOC,cACZnB,WAAWoB,QAAQrB,KAAKmB,OAAOC,OAAOE,MACtCnB,UAAUkB,QAAQrB,KAAKmB,OAAOC,OAAOG,SAE9BvB,WAED,IAAIwB,MAAMxB,KAAKyB,SAAS,GAAGC,YAEtCZ,OAAM,SAASY,gBACdtB,MAAMK,MAAK,SAASL,cAChBA,MAAMuB,OACNvB,MAAMQ,UAECR,SAEVU,MAAM5B,aAAa6B,WAEb7B,aAAa0C,gBAAgB,CAChCF,QAASA,QACTG,KAAM,iBAOgC,MAU1C,SAASvC,aACbA,KAAON,EAAEM,MACF,IAAID,cAAcC"}