Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"bulk_actions.min.js","sources":["../../../../src/bulkactions/edit/tree/bulk_actions.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\nimport BulkActions from \"core/bulkactions/bulk_actions\";\nimport GradebookEditTreeBulkMove from \"core_grades/bulkactions/edit/tree/move\";\n\n/**\n * Class for defining the bulk actions area in the gradebook setup page.\n *\n * @module     core_grades/bulkactions/edit/tree/bulk_actions\n * @copyright  2023 Mihail Geshoski <mihail@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nconst Selectors = {\n    selectBulkItemCheckbox: 'input[type=\"checkbox\"].itemselect'\n};\n\nexport default class GradebookEditTreeBulkActions extends BulkActions {\n\n    /** @property {int|null} courseID The course ID. */\n    courseID = null;\n\n    /**\n     * Returns the instance of the class.\n     *\n     * @param {int} courseID\n     * @returns {GradebookEditTreeBulkActions}\n     */\n    static init(courseID) {\n        return new this(courseID);\n    }\n\n    /**\n     * The class constructor.\n     *\n     * @param {int} courseID The course ID.\n     * @returns {void}\n     */\n    constructor(courseID) {\n        super();\n        this.courseID = courseID;\n    }\n\n    /**\n     * Returns the array of the relevant bulk action objects for the gradebook setup page.\n     *\n     * @method getBulkActions\n     * @returns {Array}\n     */\n    getBulkActions() {\n        return [\n            new GradebookEditTreeBulkMove(this.courseID)\n        ];\n    }\n\n    /**\n     * Returns the array of selected items.\n     *\n     * @method getSelectedItems\n     * @returns {Array}\n     */\n    getSelectedItems() {\n        return document.querySelectorAll(`${Selectors.selectBulkItemCheckbox}:checked`);\n    }\n\n    /**\n     * Adds the listener for the item select change event.\n     *\n     * @method registerItemSelectChangeEvent\n     * @param {function} eventHandler The event handler function.\n     * @returns {void}\n     */\n    registerItemSelectChangeEvent(eventHandler) {\n        const itemSelectCheckboxes = document.querySelectorAll(Selectors.selectBulkItemCheckbox);\n        itemSelectCheckboxes.forEach((checkbox) => {\n            checkbox.addEventListener('change', eventHandler.bind(this));\n        });\n    }\n}\n"],"names":["Selectors","GradebookEditTreeBulkActions","BulkActions","courseID","this","constructor","getBulkActions","GradebookEditTreeBulkMove","getSelectedItems","document","querySelectorAll","registerItemSelectChangeEvent","eventHandler","forEach","checkbox","addEventListener","bind"],"mappings":";;;;;;;;MA0BMA,iCACsB,0CAGPC,qCAAqCC,kCAW1CC,iBACD,IAAIC,KAAKD,UASpBE,YAAYF,0CAlBD,6IAoBFA,SAAWA,SASpBG,uBACW,CACH,IAAIC,cAA0BH,KAAKD,WAU3CK,0BACWC,SAASC,2BAAoBV,8CAUxCW,8BAA8BC,cACGH,SAASC,iBAAiBV,kCAClCa,SAASC,WAC1BA,SAASC,iBAAiB,SAAUH,aAAaI,KAAKZ"}