{"version":3,"sources":["https:\/\/vlm2.ub.ac.id\/mod\/forum\/amd\/src\/lock_toggle.js"],"names":["define","$","Templates","Notification","Repository","Selectors","init","registerEventListeners","root","preventDefault","on","lock","toggle","e","toggleElement","forumId","data","discussionId","state","setDiscussionLockState","then","location","reload","catch","exception"],"mappings":"AAuBAA,OAAM,yBAAC,CACC,QADD,CAEC,gBAFD,CAGC,mBAHD,CAIC,sBAJD,CAKC,qBALD,CAAD,CAMC,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMD,CA2BF,MAAO,CACHC,IAAI,CApBqB,QAAzBC,CAAAA,sBAAyB,CAASC,CAAT,CAAeC,CAAf,CAA+B,CACxDD,CAAI,CAACE,EAAL,CAAQ,OAAR,CAAiBL,CAAS,CAACM,IAAV,CAAeC,MAAhC,CAAwC,SAASC,CAAT,CAAY,IAC5CC,CAAAA,CAAa,CAAGb,CAAC,CAAC,IAAD,CAD2B,CAE5Cc,CAAO,CAAGD,CAAa,CAACE,IAAd,CAAmB,SAAnB,CAFkC,CAG5CC,CAAY,CAAGH,CAAa,CAACE,IAAd,CAAmB,cAAnB,CAH6B,CAI5CE,CAAK,CAAGJ,CAAa,CAACE,IAAd,CAAmB,OAAnB,CAJoC,CAMhDZ,CAAU,CAACe,sBAAX,CAAkCJ,CAAlC,CAA2CE,CAA3C,CAAyDC,CAAzD,EACKE,IADL,CACU,UAAW,CACb,MAAOC,CAAAA,QAAQ,CAACC,MAAT,EACV,CAHL,EAIKC,KAJL,CAIWpB,CAAY,CAACqB,SAJxB,EAMA,GAAIf,CAAJ,CAAoB,CAChBI,CAAC,CAACJ,cAAF,EACH,CACJ,CAfD,CAgBH,CAEM,CAGV,CA1CK,CAAN","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 .\n\n\/**\n * Handle the manual locking of individual discussions\n *\n * @module mod_forum\/lock_toggle\n * @package mod_forum\n * @copyright 2019 Peter Dias \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\ndefine([\n 'jquery',\n 'core\/templates',\n 'core\/notification',\n 'mod_forum\/repository',\n 'mod_forum\/selectors',\n ], function(\n $,\n Templates,\n Notification,\n Repository,\n Selectors\n ) {\n\n \/**\n * Register event listeners for the subscription toggle.\n *\n * @param {object} root The discussion list root element\n * @param {boolean} preventDefault Should the default action of the event be prevented\n *\/\n var registerEventListeners = function(root, preventDefault) {\n root.on('click', Selectors.lock.toggle, function(e) {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var state = toggleElement.data('state');\n\n Repository.setDiscussionLockState(forumId, discussionId, state)\n .then(function() {\n return location.reload();\n })\n .catch(Notification.exception);\n\n if (preventDefault) {\n e.preventDefault();\n }\n });\n };\n\n return {\n init: registerEventListeners\n };\n});\n"],"file":"lock_toggle.min.js"}