Proyectos de Subversion Moodle

Rev

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

{"version":3,"file":"question_status.min.js","sources":["../src/question_status.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 * Status column selector js.\n *\n * @module     qbank_editquestion/question_status\n * @copyright  2021 Catalyst IT Australia Pty Ltd\n * @author     Safat Shahin <safatshahin@catalyst-au.net>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\n/**\n * Set the question status.\n *\n * @param {Number} questionId The question id.\n * @param {String} status The updated question status.\n * @return {Array} The modified question status\n */\nconst setQuestionStatus = (questionId, status) => Ajax.call([{\n    methodname: 'qbank_editquestion_set_status',\n    args: {\n        questionid: questionId,\n        status: status\n    }\n}])[0];\n\n/**\n * Entrypoint of the js.\n *\n * @method init\n * @param {Number} questionId Question id.\n */\nexport const init = (questionId) => {\n    let target = document.querySelector('#question_status_dropdown-' + questionId);\n    target.addEventListener('change', (e) => {\n        const questionStatus = e.target.value;\n        setQuestionStatus(questionId, questionStatus)\n        .then((response) => {\n            if (response.error) {\n                Notification.addNotification({\n                    type: 'error',\n                    message: response.error\n                });\n            }\n            return;\n        }).catch();\n    });\n};\n"],"names":["questionId","document","querySelector","addEventListener","e","questionStatus","target","value","status","Ajax","call","methodname","args","questionid","setQuestionStatus","then","response","error","addNotification","type","message","catch"],"mappings":";;;;;;;;wLAgDqBA,aACJC,SAASC,cAAc,6BAA+BF,YAC5DG,iBAAiB,UAAWC,UACzBC,eAAiBD,EAAEE,OAAOC,MAjBd,EAACP,WAAYQ,SAAWC,cAAKC,KAAK,CAAC,CACzDC,WAAY,gCACZC,KAAM,CACFC,WAAYb,WACZQ,OAAQA,WAEZ,GAYIM,CAAkBd,WAAYK,gBAC7BU,MAAMC,WACCA,SAASC,6BACIC,gBAAgB,CACzBC,KAAM,QACNC,QAASJ,SAASC,WAI3BI"}