mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
1 line
5.8 KiB
Plaintext
1 line
5.8 KiB
Plaintext
{"version":3,"sources":["../src/edittree_index.js"],"names":["define","$","edittree","on","checkMoveMenuState","toggleAllSelectItems","toggleWeightInput","form","closest","bulkmove","find","val","submit","e","preventDefault","node","row","data","prop","getMoveMenu","menu","length","selected","each","enhance"],"mappings":"AAuBAA,OAAM,8BAAC,CACH,QADG,CAAD,CAEH,SAASC,CAAT,CAAY,CAMX,GAAIC,CAAAA,CAAQ,CAAG,UAAW,CAEtBD,CAAC,CAAC,MAAD,CAAD,CAAUE,EAAV,CAAa,QAAb,CAAuB,yBAAvB,CAAkDD,CAAQ,CAACE,kBAA3D,EAGAH,CAAC,CAAC,MAAD,CAAD,CAAUE,EAAV,CAAa,OAAb,CAAsB,mDAAtB,CAAyED,CAAQ,CAACG,oBAAlF,EAGAJ,CAAC,CAAC,MAAD,CAAD,CAAUE,EAAV,CAAa,QAAb,CAAuB,iBAAvB,CAA0CD,CAAQ,CAACI,iBAAnD,EAGAL,CAAC,CAAC,gBAAD,CAAD,CAAoBE,EAApB,CAAuB,QAAvB,CAAiC,UAAW,CACxC,GAAII,CAAAA,CAAI,CAAGN,CAAC,CAAC,IAAD,CAAD,CAAQO,OAAR,CAAgB,MAAhB,CAAX,CACIC,CAAQ,CAAGF,CAAI,CAACG,IAAL,CAAU,gBAAV,CADf,CAGAD,CAAQ,CAACE,GAAT,CAAa,CAAb,EACAJ,CAAI,CAACK,MAAL,EACH,CAND,EASAV,CAAQ,CAACE,kBAAT,EACH,CArBD,CA8BAF,CAAQ,CAACI,iBAAT,CAA6B,SAASO,CAAT,CAAY,CACrCA,CAAC,CAACC,cAAF,GACA,GAAIC,CAAAA,CAAI,CAAGd,CAAC,CAAC,IAAD,CAAZ,CACIe,CAAG,CAAGD,CAAI,CAACP,OAAL,CAAa,IAAb,CADV,CAGAP,CAAC,CAAC,uBAAwBe,CAAG,CAACC,IAAJ,CAAS,QAAT,CAAxB,CAA6C,KAA9C,CAAD,CAAqDC,IAArD,CAA0D,UAA1D,CAAsE,CAACH,CAAI,CAACG,IAAL,CAAU,SAAV,CAAvE,CACH,CAND,CAeAhB,CAAQ,CAACG,oBAAT,CAAgC,SAASQ,CAAT,CAAY,CACxCA,CAAC,CAACC,cAAF,GAEA,GAAIC,CAAAA,CAAI,CAAGd,CAAC,CAAC,IAAD,CAAZ,CACIe,CAAG,CAAGD,CAAI,CAACP,OAAL,CAAa,IAAb,CADV,CAEAP,CAAC,CAAC,IAAMe,CAAG,CAACC,IAAJ,CAAS,UAAT,CAAN,CAA6B,cAA9B,CAAD,CAA+CC,IAA/C,CAAoD,SAApD,CAA+DH,CAAI,CAACE,IAAL,CAAU,SAAV,CAA/D,EAEAf,CAAQ,CAACE,kBAAT,EACH,CARD,CAiBAF,CAAQ,CAACiB,WAAT,CAAuB,UAAW,CAC9B,MAAOlB,CAAAA,CAAC,CAAC,gBAAD,CACX,CAFD,CAWAC,CAAQ,CAACE,kBAAT,CAA8B,UAAW,CACrC,GAAIgB,CAAAA,CAAI,CAAGlB,CAAQ,CAACiB,WAAT,EAAX,CACA,GAAI,CAACC,CAAI,CAACC,MAAV,CAAkB,CACd,QACH,CAED,GAAIC,CAAAA,CAAJ,CACArB,CAAC,CAAC,aAAD,CAAD,CAAiBsB,IAAjB,CAAsB,UAAW,CAC7BD,CAAQ,CAAGrB,CAAC,CAAC,IAAD,CAAD,CAAQiB,IAAR,CAAa,SAAb,CAAX,CAGA,MAAO,CAACI,CACX,CALD,EAOAF,CAAI,CAACF,IAAL,CAAU,UAAV,CAAsB,CAACI,CAAvB,EAEA,MAAOA,CAAAA,CACV,CAjBD,CAmBA,MAAuD,CACnDE,OAAO,CAAEtB,CAD0C,CAG1D,CAvGK,CAAN","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 * Enhance the gradebook tree setup with various facilities.\n *\n * @module core_grades/edittree_index\n * @package core_grades\n * @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n], function($) {\n /**\n * Enhance the edittree functionality.\n *\n * @method edittree\n */\n var edittree = function() {\n // Watch items and toggle the move menu accordingly.\n $('body').on('change', '.itemselect.ignoredirty', edittree.checkMoveMenuState);\n\n // Watch for the 'All' and 'None' links.\n $('body').on('click', '[data-action=\"grade_edittree-index-bulkselect\"]', edittree.toggleAllSelectItems);\n\n // Watch for the weight override checkboxes.\n $('body').on('change', '.weightoverride', edittree.toggleWeightInput);\n\n // Watch changes to the bulk move menu and submit.\n $('#menumoveafter').on('change', function() {\n var form = $(this).closest('form'),\n bulkmove = form.find('#bulkmoveinput');\n\n bulkmove.val(1);\n form.submit();\n });\n\n // CHeck the initial state of the move menu.\n edittree.checkMoveMenuState();\n };\n\n /**\n * Toggle the weight input field based on its checkbox.\n *\n * @method toggleWeightInput\n * @param {EventFacade} e\n * @private\n */\n edittree.toggleWeightInput = function(e) {\n e.preventDefault();\n var node = $(this),\n row = node.closest('tr');\n\n $('input[name=\"weight_' + row.data('itemid') + '\"]').prop('disabled', !node.prop('checked'));\n };\n\n /**\n * Toggle all select boxes on or off.\n *\n * @method toggleAllSelectItems\n * @param {EventFacade} e\n * @private\n */\n edittree.toggleAllSelectItems = function(e) {\n e.preventDefault();\n\n var node = $(this),\n row = node.closest('tr');\n $('.' + row.data('category') + ' .itemselect').prop('checked', node.data('checked'));\n\n edittree.checkMoveMenuState();\n };\n\n /**\n * Get the move menu.\n *\n * @method getMoveMenu\n * @private\n * @return {jQuery}\n */\n edittree.getMoveMenu = function() {\n return $('#menumoveafter');\n };\n\n /**\n * Check whether any checkboxes are ticked.\n *\n * @method checkMoveMenuState\n * @private\n * @return {Boolean}\n */\n edittree.checkMoveMenuState = function() {\n var menu = edittree.getMoveMenu();\n if (!menu.length) {\n return false;\n }\n\n var selected;\n $('.itemselect').each(function() {\n selected = $(this).prop('checked');\n\n // Return early if any are checked.\n return !selected;\n });\n\n menu.prop('disabled', !selected);\n\n return selected;\n };\n\n return /** @alias module:core_grades/edittree_index */ {\n enhance: edittree\n };\n});\n"],"file":"edittree_index.min.js"} |