{"version":3,"sources":["https:\/\/moodle.tau.ac.il\/2023\/course\/format\/remuiformat\/amd\/src\/format_card.js"],"names":["define","$","Ajax","Notification","common","ordering","init","PROMISES","courseid","sectionid","activityid","call","methodname","args","document","ready","is","on","data","section","activity","this","selector","done","response","type","closest","removeClass","addClass","fail","exception"],"mappings":"AAyBAA,OAAO,CACH,SACA,YACA,oBACA,4BACA,0BACD,SAASC,EAAGC,EAAMC,EAAcC,EAAQC,GA4DvC,MAAO,CACHC,KAxDJ,WAMI,IAAIC,EASsB,SAASC,EAAUC,EAAWC,GAChD,OAAOR,EAAKS,KAAK,CAAC,CACdC,WAAY,0CACZC,KAAM,CACFL,SAAUA,EACVC,UAAWA,EACXC,WAAYA,MAEhB,IAKZT,EAAEa,UAAUC,MAAM,WACVd,EAAE,QAAQe,GAAG,aACbX,EAASC,SAKjBL,EAAE,wFAAwFgB,GAAG,QAAS,WAClG,IAAIT,EAAWP,EAAE,mBAAmBiB,KAAK,YACrCC,EAAUlB,EAAE,oBAAoBiB,KAAK,aACrCE,EAAWnB,EAAEoB,MAAMH,KAAK,cACxBI,EAAWrB,EAAEoB,MACjBd,EAA8BC,EAAUW,EAASC,GAChDG,KAAK,SAASC,GACU,OAAjBA,EAASC,KACTxB,EAAEqB,GAAUI,QAAQ,iBAAiBC,YAAY,gBAAgBC,SAAS,oCAE1E3B,EAAEqB,GAAUI,QAAQ,iBAAiBE,SAAS,gBAAgBD,YAAY,sCAGjFE,KAAK1B,EAAa2B,aAGvB1B,EAAOE","sourcesContent":["\/* eslint-disable no-unused-vars *\/\n\/* eslint-disable valid-jsdoc *\/\n\/\/ 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 * Enhancements to Cards components for easy course accessibility.\n *\n * @module format\/remuiformat\n * @copyright WisdmLabs\n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\ndefine([\n 'jquery',\n 'core\/ajax',\n 'core\/notification',\n 'format_remuiformat\/common',\n '.\/format_card_ordering'\n], function($, Ajax, Notification, common, ordering) {\n \/**\n * Init method\n *\n *\/\n function init() {\n\n \/**\n * Ajax promises\n * @type {Object}\n *\/\n var PROMISES = {\n\n \/**\n * Toggle activity view type. Either row or column\n * @param {integer} courseid Current course id\n * @param {integer} sectionid Current Section id\n * @param {integer} activityid Selected activity id\n * @return\n *\/\n SHOW_ACTIVITY_IN_ROW: function(courseid, sectionid, activityid) {\n return Ajax.call([{\n methodname: \"format_remuiformat_show_activity_in_row\",\n args: {\n courseid: courseid,\n sectionid: sectionid,\n activityid: activityid\n }\n }])[0];\n }\n };\n\n var cardminHeight = 200;\n $(document).ready(function() {\n if ($('body').is('.editing')) {\n ordering.init();\n }\n });\n\n \/\/ Call AJAX to set activity layout (Row or Card).\n $('.remui-format-card.single-section-format .activity-cards .actions .toggle-row-column').on('click', function() {\n var courseid = $('[data-courseid]').data('courseid');\n var section = $('[data-sectionid]').data('sectionid');\n var activity = $(this).data('activityid');\n var selector = $(this);\n PROMISES.SHOW_ACTIVITY_IN_ROW(courseid, section, activity)\n .done(function(response) {\n if (response.type == 'row') {\n $(selector).closest('.col-activity').removeClass('col-activity').addClass('row-activity fullwidth-grid-item');\n } else {\n $(selector).closest('.row-activity').addClass('col-activity').removeClass('row-activity fullwidth-grid-item');\n }\n })\n .fail(Notification.exception);\n });\n\n common.init();\n }\n \/\/ Must return the init function.\n\n return {\n init: init\n };\n});\n"],"file":"format_card.min.js"}