[ Index ]

PHP Cross Reference of Moodle 310

title

Body

[close]

/lib/amd/build/ -> addblockmodal.min.js.map (source)

   1  {"version":3,"file":"addblockmodal.min.js","sources":["../src/addblockmodal.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 * Show an add block modal instead of doing it on a separate page.\n *\n * @module     core/addblockmodal\n * @copyright  2016 Damyon Wiese <damyon@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/modal_factory', 'core/templates', 'core/str', 'core/notification'],\n       function($, ModalFactory, Templates, Str, Notification) {\n\n\n    return /** @alias module:core/addblockmodal */ {\n        /**\n         * Global init function for this module.\n         *\n         * @method init\n         * @param {Object} context The template context for rendering this modal body.\n         */\n        init: function(context) {\n            var addblocklink = $('[data-key=addblock]');\n\n            // We need the fetch the names of the blocks. It was too much to send in the page.\n            var titlerequests = context.blocks.map(function(blockName) {\n                return {\n                    key: 'pluginname',\n                    component: 'block_' + blockName,\n                };\n            });\n\n            var bodyPromise = Str.get_strings(titlerequests)\n            .then(function(titles) {\n                return titles.map(function(title, index) {\n                    return {\n                        name: context.blocks[index],\n                        title: title,\n                    };\n                });\n            })\n            .then(function(blocks) {\n                context.blocks = blocks;\n                return Templates.render('core/add_block_body', context);\n            })\n            .fail(Notification.exception);\n\n            var titlePromise = Str.get_string('addblock')\n            .fail(Notification.exception);\n\n            ModalFactory.create({\n                title: titlePromise,\n                body: bodyPromise,\n                type: 'CANCEL',\n            }, addblocklink);\n        }\n    };\n});\n"],"names":["define","$","ModalFactory","Templates","Str","Notification","init","context","addblocklink","titlerequests","blocks","map","blockName","key","component","bodyPromise","get_strings","then","titles","title","index","name","render","fail","exception","titlePromise","get_string","create","body","type"],"mappings":";;;;;;;AAsBAA,4BAAO,CAAC,SAAU,qBAAsB,iBAAkB,WAAY,sBAC/D,SAASC,EAAGC,aAAcC,UAAWC,IAAKC,oBAGE,CAO3CC,KAAM,SAASC,aACPC,aAAeP,EAAE,uBAGjBQ,cAAgBF,QAAQG,OAAOC,KAAI,SAASC,iBACrC,CACHC,IAAK,aACLC,UAAW,SAAWF,cAI1BG,YAAcX,IAAIY,YAAYP,eACjCQ,MAAK,SAASC,eACJA,OAAOP,KAAI,SAASQ,MAAOC,aACvB,CACHC,KAAMd,QAAQG,OAAOU,OACrBD,MAAOA,aAIlBF,MAAK,SAASP,eACXH,QAAQG,OAASA,OACVP,UAAUmB,OAAO,sBAAuBf,YAElDgB,KAAKlB,aAAamB,WAEfC,aAAerB,IAAIsB,WAAW,YACjCH,KAAKlB,aAAamB,WAEnBtB,aAAayB,OAAO,CAChBR,MAAOM,aACPG,KAAMb,YACNc,KAAM,UACPrB"}


Generated: Wed Jan 22 11:59:49 2025 Cross-referenced by PHPXref 0.7.1