1441 |
ariadna |
1 |
{"version":3,"file":"mutations.min.js","sources":["../src/mutations.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 {setUserPreference} from 'core_user/repository';\n\n/**\n * Default mutation manager\n *\n * @module qbank_managecategories/mutations\n */\nclass Mutations {\n /**\n * Set the showdescriptions property to true or false in the page's state.\n *\n * @param {stateManager} stateManager\n * @param {boolean} showDescriptions\n * @return {Promise<void>}\n */\n async toggleDescriptions(stateManager, showDescriptions) {\n stateManager.setReadOnly(false);\n await setUserPreference('qbank_managecategories_showdescriptions', showDescriptions);\n stateManager.state.page.showdescriptions = showDescriptions;\n stateManager.setReadOnly(true);\n }\n\n /**\n * Set the draghandle property to true in a given category's state.\n *\n * @param {stateManager} stateManager\n * @param {Number} categoryId\n * @return {Promise<void>}\n */\n async showDragHandle(stateManager, categoryId) {\n stateManager.setReadOnly(false);\n stateManager.state.categories.get(categoryId).draghandle = true;\n stateManager.setReadOnly(true);\n }\n}\n\nexport const mutations = new Mutations();\n"],"names":["mutations","stateManager","showDescriptions","setReadOnly","state","page","showdescriptions","categoryId","categories","get","draghandle"],"mappings":"qMAmDaA,UAAY,mCArBIC,aAAcC,kBACnCD,aAAaE,aAAY,SACnB,iCAAkB,0CAA2CD,kBACnED,aAAaG,MAAMC,KAAKC,iBAAmBJ,iBAC3CD,aAAaE,aAAY,wBAURF,aAAcM,YAC/BN,aAAaE,aAAY,GACzBF,aAAaG,MAAMI,WAAWC,IAAIF,YAAYG,YAAa,EAC3DT,aAAaE,aAAY"}
|