AutorÃa | Ultima modificación | Ver Log |
{"version":3,"file":"activity_header.min.js","sources":["../../../src/local/content/activity_header.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 * The activity header component.\n *\n * @module core_courseformat/local/content/activity_header\n * @class core_courseformat/local/content/activity_header\n * @copyright 2021 Ferran R
ecio <ferran@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {BaseComponent} from 'core/reactive';\nimport {getCurrentCourseEditor} from 'core_courseformat/courseeditor';\nimport * as CourseEvents from 'core_course/events';\n\n// Global page selectors.\nconst SELECTORS = {\n ACTIVITY_HEADER: `[data-for='page-activity-header']`,\n};\n\nexport default class Component extends BaseComponent {\n\n /**\n * Constructor hook.\n */\n create() {\n // Optional component name for debugging.\n this.name = 'activity_header';\n }\n\n /**\n * Static method to create a component instance form the mustache template.\n *\n * @param {string} target optional altentative DOM main element CSS selector\n * @param {object} selectors optional css selector overrides\n * @return {Component}\n */\n static init(target, selectors) {\n const elementselector = (target) ? target : SELECTORS.ACTIVITY_HEADER;\n retu
rn new Component({\n element: document.querySelector(elementselector),\n reactive: getCurrentCourseEditor(),\n selectors\n });\n }\n\n /**\n * Initial state ready method.\n */\n stateReady() {\n // Capture completion events.\n this.addEventListener(\n this.element,\n CourseEvents.manualCompletionToggled,\n this._completionHandler\n );\n }\n\n /**\n * Activity manual completion listener.\n *\n * @param {Event} event the custom event\n * @param {object} event.detail the event details\n */\n _completionHandler({detail}) {\n if (detail === undefined) {\n return;\n }\n this.reactive.dispatch('cmCompletion', [detail.cmid], detail.completed);\n }\n}\n"],"names":["SELECTORS","Component","BaseComponent","create","name","target","selectors","elementselector","element","document","querySelector","reactive","stateReady","addEventListener","this","C
ourseEvents","manualCompletionToggled","_completionHandler","detail","undefined","dispatch","cmid","completed"],"mappings":";;;;;;;;0BA6BMA,oEAIeC,kBAAkBC,wBAKnCC,cAESC,KAAO,8BAUJC,OAAQC,iBACVC,gBAAmBF,QAAmBL,iCACrC,IAAIC,UAAU,CACjBO,QAASC,SAASC,cAAcH,iBAChCI,UAAU,0CACVL,UAAAA,YAORM,kBAESC,iBACDC,KAAKN,QACLO,aAAaC,wBACbF,KAAKG,oBAUbA,6BAAmBC,OAACA,kBACDC,IAAXD,aAGCP,SAASS,SAAS,eAAgB,CAACF,OAAOG,MAAOH,OAAOI"}