Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
{"version":3,"file":"paged_content_paging_bar_limit_selector.min.js","sources":["../src/paged_content_paging_bar_limit_selector.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 * Javascript for dynamically changing the page limits.\n *\n * @module     core/paged_content_paging_bar_limit_selector\n * @copyright  2018 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(\n[\n    'jquery',\n    'core/custom_interaction_events',\n    'core/paged_content_events',\n    'core/pubsub'\n],\nfunction(\n    $,\n    CustomEvents,\n    PagedContentEvents,\n    PubSub\n) {\n\n    var SELECTORS = {\n        ROOT: '[data-region=\"paging-control-limit-container\"]',\n        LIMIT_OPTION: '[data-limit]',\n        LIMIT_TOGGLE: '[data-action=\"limit-toggle\"]',\n    };\n\n    /**\n     * Trigger the SET_ITEMS_PER_PAGE_LIMIT event when the page limit option\n     * is modified.\n     *\n     * @param {object} root The root element.\n     * @param {string} id A unique id for this instance.\n     */\n    var init = function(root, id) {\n        root = $(root);\n\n        CustomEvents.define(root, [\n            CustomEvents.events.activate\n        ]);\n\n        root.on(CustomEvents.events.activate, SELECTORS.LIMIT_OPTION, function(e, data) {\n            var optionElement = $(e.target).closest(SELECTORS.LIMIT_OPTION);\n\n            if (optionElement.hasClass('active')) {\n                // Don't do anything if it was the active option selected.\n                return;\n            }\n\n            var limit = parseInt(optionElement.attr('data-limit'), 10);\n            // Tell the rest of the pagination components that the limit has changed.\n            PubSub.publish(id + PagedContentEvents.SET_ITEMS_PER_PAGE_LIMIT, limit);\n\n            data.originalEvent.preventDefault();\n        });\n    };\n\n    return {\n        init: init,\n        rootSelector: SELECTORS.ROOT\n    };\n});\n"],"names":["define","$","CustomEvents","PagedContentEvents","PubSub","SELECTORS","init","root","id","events","activate","on","e","data","optionElement","target","closest","hasClass","limit","parseInt","attr","publish","SET_ITEMS_PER_PAGE_LIMIT","originalEvent","preventDefault","rootSelector"],"mappings":";;;;;;;AAsBAA,sDACA,CACI,SACA,iCACA,4BACA,gBAEJ,SACIC,EACAC,aACAC,mBACAC,YAGIC,uBAEc,qBAkCX,CACHC,KAxBO,SAASC,KAAMC,IACtBD,KAAON,EAAEM,MAETL,aAAaF,OAAOO,KAAM,CACtBL,aAAaO,OAAOC,WAGxBH,KAAKI,GAAGT,aAAaO,OAAOC,SAAUL,wBAAwB,SAASO,EAAGC,UAClEC,cAAgBb,EAAEW,EAAEG,QAAQC,QAAQX,4BAEpCS,cAAcG,SAAS,eAKvBC,MAAQC,SAASL,cAAcM,KAAK,cAAe,IAEvDhB,OAAOiB,QAAQb,GAAKL,mBAAmBmB,yBAA0BJ,OAEjEL,KAAKU,cAAcC,sBAMvBC,aArCM"}