%PDF- %PDF-
Direktori : /home/vacivi36/ava/mod/survey/amd/build/ |
Current File : /home/vacivi36/ava/mod/survey/amd/build/validation.min.js.map |
{"version":3,"file":"validation.min.js","sources":["../src/validation.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 * Javascript to handle survey validation.\n *\n * @module mod_survey/validation\n * @copyright 2017 Dan Poltawski <dan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 3.3\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/notification'], function($, Str, ModalFactory, Notification) {\n return {\n /**\n * Prevents form submission until all radio buttons are chosen, displays\n * modal error if any choices are missing.\n *\n * @param {String} formid HTML id of form\n */\n ensureRadiosChosen: function(formid) {\n // Prepare modal for display in case of problems.\n var modalPromise = Str.get_strings([\n {key: 'error', component: 'moodle'},\n {key: 'questionsnotanswered', component: 'survey'},\n ]).then(function(strings) {\n return ModalFactory.create({\n type: ModalFactory.types.CANCEL,\n title: strings[0],\n body: strings[1],\n });\n }).catch(Notification.exception);\n\n var form = $('#' + formid);\n form.submit(function(e) {\n // Look for unanswered questions..\n if (form.find('input:radio[data-survey-default=\"true\"]:checked').length !== 0) {\n e.preventDefault();\n // Display the modal error.\n return modalPromise.then(function(modal) {\n modal.show();\n return false;\n });\n }\n\n return true;\n });\n }\n };\n});\n"],"names":["define","$","Str","ModalFactory","Notification","ensureRadiosChosen","formid","modalPromise","get_strings","key","component","then","strings","create","type","types","CANCEL","title","body","catch","exception","form","submit","e","find","length","preventDefault","modal","show"],"mappings":";;;;;;;;AAuBAA,+BAAO,CAAC,SAAU,WAAY,qBAAsB,sBAAsB,SAASC,EAAGC,IAAKC,aAAcC,oBAC9F,CAOHC,mBAAoB,SAASC,YAErBC,aAAeL,IAAIM,YAAY,CAC/B,CAACC,IAAK,QAASC,UAAW,UAC1B,CAACD,IAAK,uBAAwBC,UAAW,YAC1CC,MAAK,SAASC,gBACNT,aAAaU,OAAO,CACvBC,KAAMX,aAAaY,MAAMC,OACzBC,MAAOL,QAAQ,GACfM,KAAMN,QAAQ,QAEnBO,MAAMf,aAAagB,WAElBC,KAAOpB,EAAE,IAAMK,QACnBe,KAAKC,QAAO,SAASC,UAE2D,IAAxEF,KAAKG,KAAK,mDAAmDC,SAC7DF,EAAEG,iBAEKnB,aAAaI,MAAK,SAASgB,cAC9BA,MAAMC,QACC"}