Proyectos de Subversion Moodle

Rev

Rev 1 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

{"version":3,"file":"calendar_view.min.js","sources":["../src/calendar_view.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 * This module is responsible for handle calendar day and upcoming view.\n *\n * @module     core_calendar/calendar_view\n * @copyright  2017 Simey Lameze <simey@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n    'jquery',\n    'core/notification',\n    'core_calendar/selectors',\n    'core_calendar/events',\n    'core_calendar/view_manager',\n    'core_calendar/crud'\n],\nfunction(\n    $,\n    Notification,\n    CalendarSelectors,\n    CalendarEvents,\n    CalendarViewManager,\n    CalendarCrud\n) {\n\n        var registerEventListeners = function(root, type) {\n            var body = $('body');\n\n            CalendarCrud.registerRemove(root);\n\n            var reloadFunction = 'reloadCurrent' + type.charAt(0).toUpperCase() + type.slice(1);\n\n            body.on(CalendarEvents.created, function() {\n                CalendarViewManager[reloadFunction](root);\n            });\n            body.on(CalendarEvents.deleted, function() {\n                CalendarViewManager[reloadFunction](root);\n            });\n            body.on(CalendarEvents.updated, function() {\n                CalendarViewManager[reloadFunction](root);\n            });\n\n            root.on('change', CalendarSelectors.courseSelector, function() {\n                var selectElement = $(this);\n                var courseId = selectElement.val();\n                const courseName = $(\"option:selected\", selectElement).text();\n                CalendarViewManager[reloadFunction](root, courseId, null)\n                    .then(function() {\n                        // We need to get the selector again because the content has changed.\n                        return root.find(CalendarSelectors.courseSelector).val(courseId);\n                    })\n                    .then(function() {\n                        CalendarViewManager.updateUrl('?view=' + type + '&course=' + courseId);\n                        CalendarViewManager.handleCourseChange(Number(courseId), courseName);\n                        return;\n                    })\n                    .fail(Notification.exception);\n            });\n\n            body.on(CalendarEvents.filterChanged, function(e, data) {\n                var daysWithEvent = root.find(CalendarSelectors.eventType[data.type]);\n                if (data.hidden == true) {\n                    daysWithEvent.addClass('hidden');\n                } else {\n                    daysWithEvent.removeClass('hidden');\n                }\n                CalendarViewManager.foldDayEvents(root);\n            });\n\n            var eventFormPromise = CalendarCrud.registerEventFormModal(root);\n            CalendarCrud.registerEditListeners(root, eventFormPromise);\n        };\n\n        return {\n            init: function(root, type, isCalendarBlock = false) {\n                root = $(root);\n\n                CalendarViewManager.init(root, type, isCalendarBlock);\n                registerEventListeners(root, type, isCalendarBlock);\n            }\n        };\n    });\n"],"names":["define","$","Notification","CalendarSelectors","CalendarEvents","CalendarViewManager","CalendarCrud","registerEventListeners","root","type","body","registerRemove","reloadFunction","charAt","toUpperCase","slice","on","created","deleted","updated","courseSelector","selectElement","this","courseId","val","courseName","text","then","find","updateUrl","handleCourseChange","Number","fail","exception","filterChanged","e","data","daysWithEvent","eventType","hidden","addClass","removeClass","foldDayEvents","eventFormPromise","registerEventFormModal","registerEditListeners","init","isCalendarBlock"],"mappings":";;;;;;;AAsBAA,qCAAO,CACH,SACA,oBACA,0BACA,uBACA,6BACA,uBAEJ,SACIC,EACAC,aACAC,kBACAC,eACAC,oBACAC,kBAGQC,uBAAyB,SAASC,KAAMC,UACpCC,KAAOT,EAAE,QAEbK,aAAaK,eAAeH,UAExBI,eAAiB,gBAAkBH,KAAKI,OAAO,GAAGC,cAAgBL,KAAKM,MAAM,GAEjFL,KAAKM,GAAGZ,eAAea,SAAS,WAC5BZ,oBAAoBO,gBAAgBJ,SAExCE,KAAKM,GAAGZ,eAAec,SAAS,WAC5Bb,oBAAoBO,gBAAgBJ,SAExCE,KAAKM,GAAGZ,eAAee,S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