Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
{"version":3,"file":"nav_loader.min.js","sources":["../src/nav_loader.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 * Load the nav tree items via ajax and render the response.\n *\n * @module     block_navigation/nav_loader\n * @copyright  2015 John Okely <john@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/config', 'block_navigation/ajax_response_renderer'],\n    function($, ajax, config, renderer) {\n        var URL = config.wwwroot + '/lib/ajax/getnavbranch.php';\n\n        /**\n         * Get the block instance id.\n         *\n         * @function getBlockInstanceId\n         * @param {Element} element\n         * @returns {String} the instance id\n         */\n        function getBlockInstanceId(element) {\n            return element.closest('[data-block]').attr('data-instanceid');\n        }\n\n    return {\n        load: function(element) {\n            element = $(element);\n            var promise = $.Deferred();\n            var data = {\n                elementid: element.attr('data-node-id'),\n                id: element.attr('data-node-key'),\n                type: element.attr('data-node-type'),\n                sesskey: config.sesskey,\n                instance: getBlockInstanceId(element)\n            };\n            var settings = {\n                type: 'POST',\n                dataType: 'json',\n                data: data\n            };\n\n            $.ajax(URL, settings).done(function(nodes) {\n                renderer.render(element, nodes);\n                promise.resolve();\n            });\n\n            return promise;\n        }\n    };\n});\n"],"names":["define","$","ajax","config","renderer","URL","wwwroot","getBlockInstanceId","element","closest","attr","load","promise","Deferred","settings","type","dataType","data","elementid","id","sesskey","instance","done","nodes","render","resolve"],"mappings":";;;;;;;AAsBAA,qCAAO,CAAC,SAAU,YAAa,cAAe,4CAC1C,SAASC,EAAGC,KAAMC,OAAQC,cAClBC,IAAMF,OAAOG,QAAU,sCASlBC,mBAAmBC,gBACjBA,QAAQC,QAAQ,gBAAgBC,KAAK,yBAG7C,CACHC,KAAM,SAASH,SACXA,QAAUP,EAAEO,aACRI,QAAUX,EAAEY,WAQZC,SAAW,CACXC,KAAM,OACNC,SAAU,OACVC,KAVO,CACPC,UAAWV,QAAQE,KAAK,gBACxBS,GAAIX,QAAQE,KAAK,iBACjBK,KAAMP,QAAQE,KAAK,kBACnBU,QAASjB,OAAOiB,QAChBC,SAAUd,mBAAmBC,kBAQjCP,EAAEC,KAAKG,IAAKS,UAAUQ,MAAK,SAASC,OAChCnB,SAASoB,OAAOhB,QAASe,OACzBX,QAAQa,aAGLb"}