Proyectos de Subversion Moodle

Rev

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

{"version":3,"file":"comments.min.js","sources":["../../../../src/grades/grader/gradingpanel/comments.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 * Grading panel frequently used comments selector.\n *\n * @module     gradingform_guide/grades/grader/gradingpanel/comments\n * @copyright  2019 Andrew Nicols <andrew@nicols.co.uk>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Selectors from './comments/selectors';\n\n/**\n * Manage the frequently used comments in the Marking Guide form.\n *\n * @param {String} rootId\n */\nexport const init = (rootId) => {\n    const rootNode = document.querySelector(`#${rootId}`);\n\n    rootNode.addEventListener('click', (e) => {\n        if (!e.target.matches(Selectors.frequentComment)) {\n            return;\n        }\n\n        e.preventDefault();\n\n        const clicked = e.target.closest(Selectors.frequentComment);\n        const criterion = clicked.closest(Selectors.criterion);\n        const remark = criterion.querySelector(Selectors.remark);\n\n        if (!remark) {\n            return;\n        }\n\n        // Either append the comment to an existing comment or set it as the comment.\n        if (remark.value.trim()) {\n            remark.value += `\\n${clicked.innerHTML}`;\n        } else {\n            remark.value += clicked.innerHTML;\n        }\n    });\n};\n"],"names":["rootId","document","querySelector","addEventListener","e","target","matches","Selectors","frequentComment","preventDefault","clicked","closest","remark","criterion","value","trim","innerHTML"],"mappings":";;;;;;;8JA8BqBA,SACAC,SAASC,yBAAkBF,SAEnCG,iBAAiB,SAAUC,QAC3BA,EAAEC,OAAOC,QAAQC,mBAAUC,wBAIhCJ,EAAEK,uBAEIC,QAAUN,EAAEC,OAAOM,QAAQJ,mBAAUC,iBAErCI,OADYF,QAAQC,QAAQJ,mBAAUM,WACnBX,cAAcK,mBAAUK,QAE5CA,SAKDA,OAAOE,MAAMC,OACbH,OAAOE,mBAAcJ,QAAQM,WAE7BJ,OAAOE,OAASJ,QAAQM"}