MDL-71051 core_user: create user profile field form is now modal form
[moodle.git] / user / amd / build / edit_profile_fields.min.js.map
blob1140d959d1a32c9d5c078e22bb1fce688e631605
1 {"version":3,"sources":["../src/edit_profile_fields.js"],"names":["Selectors","actions","editCategory","editField","createField","init","document","addEventListener","e","element","target","closest","preventDefault","title","getAttribute","form","ModalForm","formClass","args","id","modalConfig","returnFocus","events","FORM_SUBMITTED","window","location","reload","show","datatype","categoryid"],"mappings":"iLAeA,uD,GAYMA,CAAAA,CAAS,CAAG,CACdC,OAAO,CAAE,CACLC,YAAY,CAAE,gCADT,CAELC,SAAS,CAAE,6BAFN,CAGLC,WAAW,CAAE,+BAHR,CADK,C,QAQE,QAAPC,CAAAA,IAAO,EAAM,CACtBC,QAAQ,CAACC,gBAAT,CAA0B,OAA1B,CAAmC,SAASC,CAAT,CAAY,CAC3C,GAAIC,CAAAA,CAAO,CAAGD,CAAC,CAACE,MAAF,CAASC,OAAT,CAAiBX,CAAS,CAACC,OAAV,CAAkBC,YAAnC,CAAd,CACA,GAAIO,CAAJ,CAAa,CACTD,CAAC,CAACI,cAAF,GADS,GAEHC,CAAAA,CAAK,CAAGJ,CAAO,CAACK,YAAR,CAAqB,SAArB,EACV,iBAAU,qBAAV,CAAiC,OAAjC,CAA0CL,CAAO,CAACK,YAAR,CAAqB,WAArB,CAA1C,CADU,CAEV,iBAAU,0BAAV,CAAsC,OAAtC,CAJK,CAKHC,CAAI,CAAG,GAAIC,UAAJ,CAAc,CACvBC,SAAS,CAAE,wCADY,CAEvBC,IAAI,CAAE,CAACC,EAAE,CAAEV,CAAO,CAACK,YAAR,CAAqB,SAArB,CAAL,CAFiB,CAGvBM,WAAW,CAAE,CAACP,KAAK,CAALA,CAAD,CAHU,CAIvBQ,WAAW,CAAEZ,CAJU,CAAd,CALJ,CAWTM,CAAI,CAACR,gBAAL,CAAsBQ,CAAI,CAACO,MAAL,CAAYC,cAAlC,CAAkD,iBAAMC,CAAAA,MAAM,CAACC,QAAP,CAAgBC,M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,CAAb,CAMAM,CAAI,CAACR,gBAAL,CAAsBQ,CAAI,CAACO,MAAL,CAAYC,cAAlC,CAAkD,iBAAMC,CAAAA,MAAM,CAACC,QAAP,CAAgBC,MAAhB,EAAN,CAAlD,EACAX,CAAI,CAACY,IAAL,EACH,CACJ,CA1CD,CA2CH,C","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 ModalForm from 'core_form/modalform';\nimport {get_string as getString} from 'core/str';\n\n/**\n * User profile fields editor\n *\n * @module     core_user/edit_profile_fields\n * @package    core_user\n * @copyright  2021 Marina Glancy\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nconst Selectors = {\n    actions: {\n        editCategory: '[data-action=\"editcategory\"]',\n        editField: '[data-action=\"editfield\"]',\n        createField: '[data-action=\"createfield\"]',\n    },\n};\n\nexport const init = () => {\n    document.addEventListener('click', function(e) {\n        let element = e.target.closest(Selectors.actions.editCategory);\n        if (element) {\n            e.preventDefault();\n            const title = element.getAttribute('data-id') ?\n                getString('profileeditcategory', 'admin', element.getAttribute('data-name')) :\n                getString('profilecreatenewcategory', 'admin');\n            const form = new ModalForm({\n                formClass: 'core_user\\\\form\\\\profile_category_form',\n                args: {id: element.getAttribute('data-id')},\n                modalConfig: {title},\n                returnFocus: element,\n            });\n            form.addEventListener(form.events.FORM_SUBMITTED, () => window.location.reload());\n            form.show();\n        }\n\n        element = e.target.closest(Selectors.actions.editField);\n        if (element) {\n            e.preventDefault();\n            const form = new ModalForm({\n                formClass: 'core_user\\\\form\\\\profile_field_form',\n                args: {id: element.getAttribute('data-id')},\n                modalConfig: {title: getString('profileeditfield', 'admin', element.getAttribute('data-name'))},\n                returnFocus: element,\n            });\n            form.addEventListener(form.events.FORM_SUBMITTED, () => window.location.reload());\n            form.show();\n        }\n\n        element = e.target.closest(Selectors.actions.createField);\n        if (element) {\n            e.preventDefault();\n            const form = new ModalForm({\n                formClass: 'core_user\\\\form\\\\profile_field_form',\n                args: {datatype: element.getAttribute('data-datatype'), categoryid: element.getAttribute('data-categoryid')},\n                modalConfig: {title: getString('profilecreatenewfield', 'admin', element.getAttribute('data-datatypename'))},\n                returnFocus: element,\n            });\n            form.addEventListener(form.events.FORM_SUBMITTED, () => window.location.reload());\n            form.show();\n        }\n    });\n};"],"file":"edit_profile_fields.min.js"}