%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/vacivi36/ava/grade/report/singleview/amd/build/
Upload File :
Create Path :
Current File : /home/vacivi36/ava/grade/report/singleview/amd/build/grade.min.js.map

{"version":3,"file":"grade.min.js","sources":["../src/grade.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 * A small modal to search grade items within the gradebook.\n *\n * @module    gradereport_singleview\n * @copyright 2022 Mathew May <mathew.solutions>\n * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Pending from 'core/pending';\nimport * as Templates from 'core/templates';\nimport * as Repository from 'core_grades/searchwidget/repository';\nimport * as WidgetBase from 'core_grades/searchwidget/basewidget';\nimport $ from 'jquery';\nimport * as Selectors from 'core_grades/searchwidget/selectors';\n\n/**\n * Our entry point into starting to build the search widget.\n * It'll eventually, based upon the listeners, open the search widget and allow filtering.\n *\n * @method init\n */\nexport const init = () => {\n    const pendingPromise = new Pending();\n    registerListenerEvents();\n    pendingPromise.resolve();\n};\n\n/**\n * Register grade item search widget related event listeners.\n *\n * @method registerListenerEvents\n */\nconst registerListenerEvents = () => {\n    let {bodyPromiseResolver, bodyPromise} = WidgetBase.promisesAndResolvers();\n    const dropdownMenuContainer = document.querySelector(Selectors.elements.getSearchWidgetDropdownSelector('grade'));\n\n    // Handle the 'shown.bs.dropdown' event (Fired when the dropdown menu is fully displayed).\n    $(Selectors.elements.getSearchWidgetSelector('grade')).on('show.bs.dropdown', async(e) => {\n        const courseID = e.relatedTarget.dataset.courseid;\n        // Display a loading icon in the dropdown menu container until the body promise is resolved.\n        await WidgetBase.showLoader(dropdownMenuContainer);\n\n        // If an error occurs while fetching the data, display the error within the modal.\n        const data = await Repository.gradeitemFetch(courseID).catch(async(e) => {\n            const errorTemplateData = {\n                'errormessage': e.message\n            };\n            bodyPromiseResolver(\n                await Templates.render('core_grades/searchwidget/error', errorTemplateData)\n            );\n        });\n\n        // Early return if there is no module data.\n        if (data === []) {\n            return;\n        }\n\n        await WidgetBase.init(\n            dropdownMenuContainer,\n            bodyPromise,\n            data.gradeitems,\n            searchGradeitems()\n        );\n\n        // Resolvers for passed functions in the modal creation.\n        bodyPromiseResolver(Templates.render('gradereport_singleview/gradesearch_body', []));\n    });\n\n    // Handle the 'hide.bs.dropdown' event (Fired when the dropdown menu is being closed).\n    $(Selectors.elements.getSearchWidgetSelector('grade')).on('hide.bs.dropdown', () => {\n        // Reset the state once the grade item menu dropdown is closed.\n        dropdownMenuContainer.innerHTML = '';\n    });\n};\n\n/**\n * Define how we want to search and filter grade items when the user decides to input a search value.\n *\n * @method registerListenerEvents\n * @returns {function(): function(*, *): (*)}\n */\nconst searchGradeitems = () => {\n    return () => {\n        return (modules, searchTerm) => {\n            if (searchTerm === '') {\n                return modules;\n            }\n            searchTerm = searchTerm.toLowerCase();\n            const searchResults = [];\n            modules.forEach((module) => {\n                const moduleName = module.name.toLowerCase();\n                if (moduleName.includes(searchTerm)) {\n                    searchResults.push(module);\n                }\n            });\n            return searchResults;\n        };\n    };\n};\n"],"names":["pendingPromise","Pending","registerListenerEvents","resolve","bodyPromiseResolver","bodyPromise","WidgetBase","promisesAndResolvers","dropdownMenuContainer","document","querySelector","Selectors","elements","getSearchWidgetDropdownSelector","getSearchWidgetSelector","on","async","courseID","e","relatedTarget","dataset","courseid","showLoader","data","Repository","gradeitemFetch","catch","errorTemplateData","message","Templates","render","init","gradeitems","searchGradeitems","innerHTML","modules","searchTerm","toLowerCase","searchResults","forEach","module","name","includes","push"],"mappings":";;;;;;;0WAoCoB,WACVA,eAAiB,IAAIC,iBAC3BC,yBACAF,eAAeG,iBAQbD,uBAAyB,SACvBE,oBAACA,oBAADC,YAAsBA,aAAeC,WAAWC,6BAC9CC,sBAAwBC,SAASC,cAAcC,UAAUC,SAASC,gCAAgC,8BAGtGF,UAAUC,SAASE,wBAAwB,UAAUC,GAAG,oBAAoBC,MAAAA,UACpEC,SAAWC,EAAEC,cAAcC,QAAQC,eAEnCf,WAAWgB,WAAWd,6BAGtBe,WAAaC,WAAWC,eAAeR,UAAUS,OAAMV,MAAAA,UACnDW,kBAAoB,cACNT,EAAEU,SAEtBxB,0BACUyB,UAAUC,OAAO,iCAAkCH,uBAK7DJ,OAAS,WAIPjB,WAAWyB,KACbvB,sBACAH,YACAkB,KAAKS,WACLC,oBAIJ7B,oBAAoByB,UAAUC,OAAO,0CAA2C,6BAIlFnB,UAAUC,SAASE,wBAAwB,UAAUC,GAAG,oBAAoB,KAE1EP,sBAAsB0B,UAAY,OAUpCD,iBAAmB,IACd,IACI,CAACE,QAASC,iBACM,KAAfA,kBACOD,QAEXC,WAAaA,WAAWC,oBAClBC,cAAgB,UACtBH,QAAQI,SAASC,SACMA,OAAOC,KAAKJ,cAChBK,SAASN,aACpBE,cAAcK,KAAKH,WAGpBF"}

Zerion Mini Shell 1.0