mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
Merge branch 'MDL-72013-master-int' of git://github.com/andrewnicols/moodle
This commit is contained in:
commit
6863a92722
64
.eslintrc
64
.eslintrc
@ -2,6 +2,7 @@
|
||||
'plugins': [
|
||||
'babel',
|
||||
'promise',
|
||||
'jsdoc',
|
||||
],
|
||||
'env': {
|
||||
'browser': true,
|
||||
@ -191,7 +192,6 @@
|
||||
'property': 'str',
|
||||
'message': 'Use AMD module "core/str" or M.util.get_string()'
|
||||
}],
|
||||
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
@ -200,7 +200,23 @@
|
||||
rules: {
|
||||
'no-undef': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'no-unused-expressions': 'off'
|
||||
'no-unused-expressions': 'off',
|
||||
|
||||
// === JSDocs ===
|
||||
"jsdoc/check-access": 'off',
|
||||
"jsdoc/check-alignment": 'off',
|
||||
"jsdoc/check-param-names": 'off',
|
||||
"jsdoc/check-property-names": 'off',
|
||||
"jsdoc/empty-tags": 'off',
|
||||
"jsdoc/implements-on-classes": 'off',
|
||||
"jsdoc/multiline-blocks": 'off',
|
||||
"jsdoc/require-jsdoc": 'off',
|
||||
"jsdoc/require-param": 'off',
|
||||
"jsdoc/require-param-name": 'off',
|
||||
"jsdoc/require-param-type": 'off',
|
||||
"jsdoc/require-property": 'off',
|
||||
"jsdoc/require-property-name": 'off',
|
||||
"jsdoc/require-property-type": 'off',
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -238,7 +254,49 @@
|
||||
// === Promises ===
|
||||
// We have Promise now that we're using ES6.
|
||||
'promise/no-native': 'off',
|
||||
'promise/avoid-new': 'off'
|
||||
'promise/avoid-new': 'off',
|
||||
|
||||
// === JSDocs ===
|
||||
"jsdoc/check-access": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/check-alignment": 1, // Recommended.
|
||||
"jsdoc/check-param-names": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/check-property-names": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/empty-tags": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/implements-on-classes": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/multiline-blocks": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-jsdoc": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-param": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-param-name": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-param-type": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-property": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-property-name": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-property-type": [
|
||||
'error',
|
||||
],
|
||||
},
|
||||
parserOptions: {
|
||||
'ecmaVersion': 9,
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -98,8 +98,7 @@ define(['jquery'], function($) {
|
||||
/**
|
||||
* Callback to inject the template.
|
||||
*
|
||||
* @param {Node} container Node to inject in.
|
||||
* @return {Promise} Resolved when done.
|
||||
* @returns {Promise} Resolved when done.
|
||||
* @method injectTemplate
|
||||
*/
|
||||
Rule.prototype.injectTemplate = function() {
|
||||
|
@ -37,9 +37,6 @@ define(['jquery',
|
||||
|
||||
/**
|
||||
* Constructor for CompetencyDialogue.
|
||||
*
|
||||
* @param {Object} options
|
||||
*
|
||||
*/
|
||||
var Competencydialogue = function() {
|
||||
// Intentionally left empty.
|
||||
|
@ -156,9 +156,8 @@ define(['jquery',
|
||||
/**
|
||||
* Opens the picker.
|
||||
*
|
||||
* @param {Number} competencyId The competency ID of the competency to work on.
|
||||
* @method display
|
||||
* @return {Promise}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
RuleConfig.prototype.display = function() {
|
||||
var self = this;
|
||||
|
@ -137,7 +137,6 @@ define(['jquery',
|
||||
/**
|
||||
* Refresh the course competencies page.
|
||||
*
|
||||
* @param {Event} e
|
||||
* @method saveSettings
|
||||
*/
|
||||
settingsMod.prototype.refreshCourseCompetenciesPage = function() {
|
||||
|
@ -26,7 +26,7 @@ define(['core/str', 'core/yui'], function(str, Y) {
|
||||
/**
|
||||
* Store the current instance of the core drag drop.
|
||||
*
|
||||
* @property dragDropInstance M.tool_lp.dragdrop_reorder
|
||||
* @property {object} dragDropInstance M.tool_lp.dragdrop_reorder
|
||||
*/
|
||||
var dragDropInstance = null;
|
||||
|
||||
|
@ -99,7 +99,6 @@ define(['jquery',
|
||||
/**
|
||||
* Opens the picker.
|
||||
*
|
||||
* @param {Number} competencyId The competency ID of the competency to work on.
|
||||
* @method display
|
||||
* @return {Promise}
|
||||
*/
|
||||
|
@ -43,8 +43,8 @@ define(['jquery'], function($) {
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param {$} menuRoot Jquery collection matching the root of the menu.
|
||||
* @param {Function[]} handlers, called when a menu item is chosen.
|
||||
* @param {jQuery} menuRoot Jquery collection matching the root of the menu.
|
||||
* @param {Function[]} handlers called when a menu item is chosen.
|
||||
*/
|
||||
var Menubar = function(menuRoot, handlers) {
|
||||
// Setup private class variables.
|
||||
|
@ -574,8 +574,6 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
* Handle a blur event
|
||||
*
|
||||
* @method handleBlur
|
||||
* @param {Object} item item is the jquery id of the parent item of the group
|
||||
* @param {Event} e The event.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Tree.prototype.handleBlur = function() {
|
||||
@ -587,7 +585,6 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
*
|
||||
* @method handleFocus
|
||||
* @param {Object} item item is the jquery id of the parent item of the group
|
||||
* @param {Event} e The event.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Tree.prototype.handleFocus = function(item) {
|
||||
|
@ -31,8 +31,6 @@ define(['jquery',
|
||||
|
||||
/**
|
||||
* UserCompetencyWorkflow class.
|
||||
*
|
||||
* @param {String} selector The node containing the buttons to switch mode.
|
||||
*/
|
||||
var UserCompetencyWorkflow = function() {
|
||||
EventBase.prototype.constructor.apply(this, []);
|
||||
|
@ -195,7 +195,6 @@ define(['jquery',
|
||||
*
|
||||
* @param {Object} evidenceData Evidence data from evidence node.
|
||||
* @param {Number} competencyIds The competency IDs.
|
||||
* @param {Boolean} requestReview Send competencies to review.
|
||||
*/
|
||||
UserEvidenceActions.prototype._doCreateUserEvidenceCompetency = function(evidenceData, competencyIds) {
|
||||
var self = this,
|
||||
|
File diff suppressed because one or more lines are too long
@ -30,6 +30,8 @@ function($, Ajax, Notification, ModalFactory, ModalEvents) {
|
||||
|
||||
/**
|
||||
* PolicyActions class.
|
||||
*
|
||||
* @param {jQuery} root
|
||||
*/
|
||||
var PolicyActions = function(root) {
|
||||
this.registerEvents(root);
|
||||
@ -37,6 +39,8 @@ function($, Ajax, Notification, ModalFactory, ModalEvents) {
|
||||
|
||||
/**
|
||||
* Register event listeners.
|
||||
*
|
||||
* @param {jQuery} root
|
||||
*/
|
||||
PolicyActions.prototype.registerEvents = function(root) {
|
||||
root.on("click", function(e) {
|
||||
@ -115,6 +119,7 @@ function($, Ajax, Notification, ModalFactory, ModalEvents) {
|
||||
* Initialise the actions helper.
|
||||
*
|
||||
* @method init
|
||||
* @param {object} root
|
||||
* @return {PolicyActions}
|
||||
*/
|
||||
'init': function(root) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -33,6 +33,7 @@
|
||||
* Events for the component.
|
||||
*
|
||||
* @constant
|
||||
* @property {object} eventTypes
|
||||
* @property {String} eventTypes.stepRender See {@link event:tool_usertours/stepRender}
|
||||
* @property {String} eventTypes.stepRendered See {@link event:tool_usertours/stepRendered}
|
||||
* @property {String} eventTypes.tourStart See {@link event:tool_usertours/tourStart}
|
||||
|
File diff suppressed because one or more lines are too long
@ -203,7 +203,7 @@ const toggleAccessMap = (courseId, displayFormat) => {
|
||||
* @param {Object[]} sectionData The error data for course sections.
|
||||
* @param {Object[]} moduleData The error data for course modules.
|
||||
* @returns {Object} An object representing the extra error information.
|
||||
*/
|
||||
*/
|
||||
const getErrorTotals = (sectionData, moduleData) => {
|
||||
const totals = {
|
||||
totalErrors: 0,
|
||||
@ -290,7 +290,6 @@ const fetchReviewData = (courseid, updatePreference = false) => {
|
||||
* @param {number} toggled A number represnting the state of the review toggle.
|
||||
* @param {string} displayFormat A string representing the display format for icons.
|
||||
* @param {number} courseId The course ID.
|
||||
* @param {number} userId The id of the currently logged-in user.
|
||||
*/
|
||||
export const init = (toggled, displayFormat, courseId) => {
|
||||
// Settings consts.
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -97,6 +97,8 @@ define([
|
||||
/**
|
||||
* This will add a visual indicator to the calendar UI to
|
||||
* indicate which nav link is a valid drop zone.
|
||||
*
|
||||
* @param {Event} e
|
||||
*/
|
||||
var dragstartHandler = function(e) {
|
||||
// Make sure the drag event is for a calendar event.
|
||||
|
@ -137,9 +137,9 @@ define([
|
||||
* The current drag target and the 2 days following it (including
|
||||
* wrapping to the next week if necessary).
|
||||
*
|
||||
* @param {string|object} target The drag target element
|
||||
* @param {string|object} dropZone The drag target element
|
||||
* @param {bool} hovered If the target is hovered or not
|
||||
* @param {int} count How many days to highlight (default to duration)
|
||||
* @param {Number} count How many days to highlight (default to duration)
|
||||
*/
|
||||
var updateHoverState = function(dropZone, hovered, count) {
|
||||
if (typeof count === 'undefined') {
|
||||
|
File diff suppressed because one or more lines are too long
@ -228,8 +228,8 @@ const updateButtonTitle = (button, ascending) => {
|
||||
* @method updateSortOrder
|
||||
* @param {HTMLElement} fileArea the Dom container for the itemlist
|
||||
* @param {Array} itemList Nodelist of Dom elements
|
||||
* @param {String} attribute, the attribut to sort on
|
||||
* @param {Bool} ascending, Sort Ascending
|
||||
* @param {String} attribute the attribut to sort on
|
||||
* @param {Bool} ascending Sort Ascending
|
||||
*/
|
||||
const updateSortOrder = (fileArea, itemList, attribute, ascending) => {
|
||||
const sortList = [].slice.call(itemList).sort(function(a, b) {
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/courseeditor.js"],"names":["courseEditorMap","Map","dispatchStateChangedEvent","detail","target","document","dispatchEvent","CustomEvent","events","stateChanged","bubbles","setViewFormat","courseId","setup","editor","getCourseEditor","parseInt","has","set","CourseEditor","name","eventName","eventDispatch","mutations","DefaultMutations","get","loadCourse","getCurrentCourseEditor","M","cfg"],"mappings":"iUAuBA,OACA,OACA,O,mDAGA,GAAMA,CAAAA,CAAe,CAAG,GAAIC,CAAAA,GAA5B,CAYA,QAASC,CAAAA,CAAT,CAAmCC,CAAnC,CAA2CC,CAA3C,CAAmD,CAC/C,GAAIA,CAAM,SAAV,CAA0B,CACtBA,CAAM,CAAGC,QACZ,CACDD,CAAM,CAACE,aAAP,CAAqB,GAAIC,CAAAA,WAAJ,CAAgBC,UAAOC,YAAvB,CAAqC,CACtDC,OAAO,GAD+C,CAEtDP,MAAM,CAAEA,CAF8C,CAArC,CAArB,CAIH,C,gBAU4B,QAAhBQ,CAAAA,aAAgB,CAACC,CAAD,CAAWC,CAAX,CAAqB,CAC9C,GAAMC,CAAAA,CAAM,CAAGC,CAAe,CAACH,CAAD,CAA9B,CACAE,CAAM,CAACH,aAAP,CAAqBE,CAArB,CACH,C,CAQM,GAAME,CAAAA,CAAe,CAAG,SAACH,CAAD,CAAc,CACzCA,CAAQ,CAAGI,QAAQ,CAACJ,CAAD,CAAnB,CAEA,GAAI,CAACZ,CAAe,CAACiB,GAAhB,CAAoBL,CAApB,CAAL,CAAoC,CAChCZ,CAAe,CAACkB,GAAhB,CACIN,CADJ,CAEI,GAAIO,UAAJ,CAAiB,CACbC,IAAI,uBAAiBR,CAAjB,CADS,CAEbS,SAAS,CAAEb,UAAOC,YAFL,CAGba,aAAa,CAAEpB,CAHF,CAMbqB,SAAS,CAAE,GAAIC,UANF,CAAjB,CAFJ,EAWAxB,CAAe,CAACyB,GAAhB,CAAoBb,CAApB,EAA8Bc,UAA9B,CAAyCd,CAAzC,CACH,CACD,MAAOZ,CAAAA,CAAe,CAACyB,GAAhB,CAAoBb,CAApB,CACV,CAlBM,C,6CAyB+B,QAAzBe,CAAAA,sBAAyB,SAAMZ,CAAAA,CAAe,CAACa,CAAC,CAACC,GAAF,CAAMjB,QAAP,CAArB,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\n/**\n * Generic reactive module used in the course editor.\n *\n * @module core_courseformat/courseeditor\n * @copyright 2021 Ferran Recio <ferran@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport DefaultMutations from 'core_courseformat/local/courseeditor/mutations';\nimport CourseEditor from 'core_courseformat/local/courseeditor/courseeditor';\nimport events from 'core_course/events';\n\n// A map with all the course editor instances.\nconst courseEditorMap = new Map();\n\n/**\n * Trigger a state changed event.\n *\n * This function will be moved to core_course/events module\n * when the file is migrated to the new JS events structure proposed in MDL-70990.\n *\n * @method dispatchStateChangedEvent\n * @param {object} detail the full state\n * @param {object} target the custom event target (document if none provided)\n */\nfunction dispatchStateChangedEvent(detail, target) {\n if (target === undefined) {\n target = document;\n }\n target.dispatchEvent(new CustomEvent(events.stateChanged, {\n bubbles: true,\n detail: detail,\n }));\n}\n\n/**\n * Setup the current view settings\n *\n * @param {number} courseId the course id\n * @param {setup} setup format, page and course settings\n * @property {boolean} setup.editing if the page is in edit mode\n * @property {boolean} setup.supportscomponents if the format supports components for content\n */\nexport const setViewFormat = (courseId, setup) => {\n const editor = getCourseEditor(courseId);\n editor.setViewFormat(setup);\n};\n\n/**\n * Get a specific course editor reactive instance.\n *\n * @param {number} courseId the course id\n * @returns {CourseEditor}\n */\nexport const getCourseEditor = (courseId) => {\n courseId = parseInt(courseId);\n\n if (!courseEditorMap.has(courseId)) {\n courseEditorMap.set(\n courseId,\n new CourseEditor({\n name: `CourseEditor${courseId}`,\n eventName: events.stateChanged,\n eventDispatch: dispatchStateChangedEvent,\n // Mutations can be overridden by the format plugin using setMutations\n // but we need the default one at least.\n mutations: new DefaultMutations(),\n })\n );\n courseEditorMap.get(courseId).loadCourse(courseId);\n }\n return courseEditorMap.get(courseId);\n};\n\n/**\n * Get the current course reactive instance.\n *\n * @returns {CourseEditor}\n */\nexport const getCurrentCourseEditor = () => getCourseEditor(M.cfg.courseId);\n"],"file":"courseeditor.min.js"}
|
||||
{"version":3,"sources":["../src/courseeditor.js"],"names":["courseEditorMap","Map","dispatchStateChangedEvent","detail","target","document","dispatchEvent","CustomEvent","events","stateChanged","bubbles","setViewFormat","courseId","setup","editor","getCourseEditor","parseInt","has","set","CourseEditor","name","eventName","eventDispatch","mutations","DefaultMutations","get","loadCourse","getCurrentCourseEditor","M","cfg"],"mappings":"iUAuBA,OACA,OACA,O,mDAGA,GAAMA,CAAAA,CAAe,CAAG,GAAIC,CAAAA,GAA5B,CAYA,QAASC,CAAAA,CAAT,CAAmCC,CAAnC,CAA2CC,CAA3C,CAAmD,CAC/C,GAAIA,CAAM,SAAV,CAA0B,CACtBA,CAAM,CAAGC,QACZ,CACDD,CAAM,CAACE,aAAP,CAAqB,GAAIC,CAAAA,WAAJ,CAAgBC,UAAOC,YAAvB,CAAqC,CACtDC,OAAO,GAD+C,CAEtDP,MAAM,CAAEA,CAF8C,CAArC,CAArB,CAIH,C,gBAU4B,QAAhBQ,CAAAA,aAAgB,CAACC,CAAD,CAAWC,CAAX,CAAqB,CAC9C,GAAMC,CAAAA,CAAM,CAAGC,CAAe,CAACH,CAAD,CAA9B,CACAE,CAAM,CAACH,aAAP,CAAqBE,CAArB,CACH,C,CAQM,GAAME,CAAAA,CAAe,CAAG,SAACH,CAAD,CAAc,CACzCA,CAAQ,CAAGI,QAAQ,CAACJ,CAAD,CAAnB,CAEA,GAAI,CAACZ,CAAe,CAACiB,GAAhB,CAAoBL,CAApB,CAAL,CAAoC,CAChCZ,CAAe,CAACkB,GAAhB,CACIN,CADJ,CAEI,GAAIO,UAAJ,CAAiB,CACbC,IAAI,uBAAiBR,CAAjB,CADS,CAEbS,SAAS,CAAEb,UAAOC,YAFL,CAGba,aAAa,CAAEpB,CAHF,CAMbqB,SAAS,CAAE,GAAIC,UANF,CAAjB,CAFJ,EAWAxB,CAAe,CAACyB,GAAhB,CAAoBb,CAApB,EAA8Bc,UAA9B,CAAyCd,CAAzC,CACH,CACD,MAAOZ,CAAAA,CAAe,CAACyB,GAAhB,CAAoBb,CAApB,CACV,CAlBM,C,6CAyB+B,QAAzBe,CAAAA,sBAAyB,SAAMZ,CAAAA,CAAe,CAACa,CAAC,CAACC,GAAF,CAAMjB,QAAP,CAArB,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\n/**\n * Generic reactive module used in the course editor.\n *\n * @module core_courseformat/courseeditor\n * @copyright 2021 Ferran Recio <ferran@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport DefaultMutations from 'core_courseformat/local/courseeditor/mutations';\nimport CourseEditor from 'core_courseformat/local/courseeditor/courseeditor';\nimport events from 'core_course/events';\n\n// A map with all the course editor instances.\nconst courseEditorMap = new Map();\n\n/**\n * Trigger a state changed event.\n *\n * This function will be moved to core_course/events module\n * when the file is migrated to the new JS events structure proposed in MDL-70990.\n *\n * @method dispatchStateChangedEvent\n * @param {object} detail the full state\n * @param {object} target the custom event target (document if none provided)\n */\nfunction dispatchStateChangedEvent(detail, target) {\n if (target === undefined) {\n target = document;\n }\n target.dispatchEvent(new CustomEvent(events.stateChanged, {\n bubbles: true,\n detail: detail,\n }));\n}\n\n/**\n * Setup the current view settings\n *\n * @param {number} courseId the course id\n * @param {setup} setup format, page and course settings\n * @param {boolean} setup.editing if the page is in edit mode\n * @param {boolean} setup.supportscomponents if the format supports components for content\n */\nexport const setViewFormat = (courseId, setup) => {\n const editor = getCourseEditor(courseId);\n editor.setViewFormat(setup);\n};\n\n/**\n * Get a specific course editor reactive instance.\n *\n * @param {number} courseId the course id\n * @returns {CourseEditor}\n */\nexport const getCourseEditor = (courseId) => {\n courseId = parseInt(courseId);\n\n if (!courseEditorMap.has(courseId)) {\n courseEditorMap.set(\n courseId,\n new CourseEditor({\n name: `CourseEditor${courseId}`,\n eventName: events.stateChanged,\n eventDispatch: dispatchStateChangedEvent,\n // Mutations can be overridden by the format plugin using setMutations\n // but we need the default one at least.\n mutations: new DefaultMutations(),\n })\n );\n courseEditorMap.get(courseId).loadCourse(courseId);\n }\n return courseEditorMap.get(courseId);\n};\n\n/**\n * Get the current course reactive instance.\n *\n * @returns {CourseEditor}\n */\nexport const getCurrentCourseEditor = () => getCourseEditor(M.cfg.courseId);\n"],"file":"courseeditor.min.js"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/local/content/section/cmitem.js"],"names":["name","selectors","DRAGICON","classes","LOCKED","id","element","dataset","configDragDrop","getElement","classList","add","watch","handler","unregister","_refreshCm","toggle","DRAGGING","dragging","locked","DndCmItem"],"mappings":"mNA0BA,uD,gwDAOa,CAEL,KAAKA,IAAL,CAAY,wBAAZ,CAEA,KAAKC,SAAL,CAAiB,CACbC,QAAQ,gBADK,CAAjB,CAIA,KAAKC,OAAL,CAAe,CACXC,MAAM,CAAE,gBADG,CAAf,CAIA,KAAKC,EAAL,CAAU,KAAKC,OAAL,CAAaC,OAAb,CAAqBF,EAClC,C,+CAKY,OACT,KAAKG,cAAL,CAAoB,KAAKH,EAAzB,EACA,eAAKI,UAAL,CAAgB,KAAKR,SAAL,CAAeC,QAA/B,wBAA0CQ,SAA1C,CAAoDC,GAApD,CAAwD,KAAKR,OAAL,CAAaD,QAArE,CACH,C,iDAOa,CACV,MAAO,CACH,CAACU,KAAK,cAAQ,KAAKP,EAAb,aAAN,CAAkCQ,OAAO,CAAE,KAAKC,UAAhD,CADG,CAEH,CAACF,KAAK,cAAQ,KAAKP,EAAb,aAAN,CAAkCQ,OAAO,CAAE,KAAKE,UAAhD,CAFG,CAIV,C,gDAOqB,SAAVT,CAAU,GAAVA,OAAU,CAElB,KAAKA,OAAL,CAAaI,SAAb,CAAuBM,MAAvB,CAA8B,KAAKb,OAAL,CAAac,QAA3C,WAAqDX,CAAO,CAACY,QAA7D,oBACA,KAAKZ,OAAL,CAAaI,SAAb,CAAuBM,MAAvB,CAA8B,KAAKb,OAAL,CAAaC,MAA3C,WAAmDE,CAAO,CAACa,MAA3D,oBACA,KAAKA,MAAL,CAAcb,CAAO,CAACa,MACzB,C,cAlDwBC,S","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 * Course course module item component.\n *\n * This component is used to control specific course modules interactions like drag and drop.\n *\n * @module core_courseformat/local/content/section/cmitem\n * @class core_courseformat/local/content/section/cmitem\n * @copyright 2021 Ferran Recio <ferran@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport DndCmItem from 'core_courseformat/local/courseeditor/dndcmitem';\n\nexport default class extends DndCmItem {\n\n /**\n * Constructor hook.\n */\n create() {\n // Optional component name for debugging.\n this.name = 'content_section_cmitem';\n // Default query selectors.\n this.selectors = {\n DRAGICON: `.editing_move`,\n };\n // Most classes will be loaded later by DndCmItem.\n this.classes = {\n LOCKED: 'editinprogress',\n };\n // We need our id to watch specific events.\n this.id = this.element.dataset.id;\n }\n\n /**\n * Initial state ready method.\n */\n stateReady() {\n this.configDragDrop(this.id);\n this.getElement(this.selectors.DRAGICON)?.classList.add(this.classes.DRAGICON);\n }\n\n /**\n * Component watchers.\n *\n * @returns {Array} of watchers\n */\n getWatchers() {\n return [\n {watch: `cm[${this.id}]:deleted`, handler: this.unregister},\n {watch: `cm[${this.id}]:updated`, handler: this._refreshCm},\n ];\n }\n\n /**\n * Update a course index cm using the state information.\n *\n * @param {Object} details the update details.\n */\n _refreshCm({element}) {\n // Update classes.\n this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false);\n this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);\n this.locked = element.locked;\n }\n}"],"file":"cmitem.min.js"}
|
||||
{"version":3,"sources":["../../../../src/local/content/section/cmitem.js"],"names":["name","selectors","DRAGICON","classes","LOCKED","id","element","dataset","configDragDrop","getElement","classList","add","watch","handler","unregister","_refreshCm","toggle","DRAGGING","dragging","locked","DndCmItem"],"mappings":"mNA0BA,uD,gwDAOa,CAEL,KAAKA,IAAL,CAAY,wBAAZ,CAEA,KAAKC,SAAL,CAAiB,CACbC,QAAQ,gBADK,CAAjB,CAIA,KAAKC,OAAL,CAAe,CACXC,MAAM,CAAE,gBADG,CAAf,CAIA,KAAKC,EAAL,CAAU,KAAKC,OAAL,CAAaC,OAAb,CAAqBF,EAClC,C,+CAKY,OACT,KAAKG,cAAL,CAAoB,KAAKH,EAAzB,EACA,eAAKI,UAAL,CAAgB,KAAKR,SAAL,CAAeC,QAA/B,wBAA0CQ,SAA1C,CAAoDC,GAApD,CAAwD,KAAKR,OAAL,CAAaD,QAArE,CACH,C,iDAOa,CACV,MAAO,CACH,CAACU,KAAK,cAAQ,KAAKP,EAAb,aAAN,CAAkCQ,OAAO,CAAE,KAAKC,UAAhD,CADG,CAEH,CAACF,KAAK,cAAQ,KAAKP,EAAb,aAAN,CAAkCQ,OAAO,CAAE,KAAKE,UAAhD,CAFG,CAIV,C,gDAQqB,SAAVT,CAAU,GAAVA,OAAU,CAElB,KAAKA,OAAL,CAAaI,SAAb,CAAuBM,MAAvB,CAA8B,KAAKb,OAAL,CAAac,QAA3C,WAAqDX,CAAO,CAACY,QAA7D,oBACA,KAAKZ,OAAL,CAAaI,SAAb,CAAuBM,MAAvB,CAA8B,KAAKb,OAAL,CAAaC,MAA3C,WAAmDE,CAAO,CAACa,MAA3D,oBACA,KAAKA,MAAL,CAAcb,CAAO,CAACa,MACzB,C,cAnDwBC,S","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 * Course course module item component.\n *\n * This component is used to control specific course modules interactions like drag and drop.\n *\n * @module core_courseformat/local/content/section/cmitem\n * @class core_courseformat/local/content/section/cmitem\n * @copyright 2021 Ferran Recio <ferran@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport DndCmItem from 'core_courseformat/local/courseeditor/dndcmitem';\n\nexport default class extends DndCmItem {\n\n /**\n * Constructor hook.\n */\n create() {\n // Optional component name for debugging.\n this.name = 'content_section_cmitem';\n // Default query selectors.\n this.selectors = {\n DRAGICON: `.editing_move`,\n };\n // Most classes will be loaded later by DndCmItem.\n this.classes = {\n LOCKED: 'editinprogress',\n };\n // We need our id to watch specific events.\n this.id = this.element.dataset.id;\n }\n\n /**\n * Initial state ready method.\n */\n stateReady() {\n this.configDragDrop(this.id);\n this.getElement(this.selectors.DRAGICON)?.classList.add(this.classes.DRAGICON);\n }\n\n /**\n * Component watchers.\n *\n * @returns {Array} of watchers\n */\n getWatchers() {\n return [\n {watch: `cm[${this.id}]:deleted`, handler: this.unregister},\n {watch: `cm[${this.id}]:updated`, handler: this._refreshCm},\n ];\n }\n\n /**\n * Update a course index cm using the state information.\n *\n * @param {object} param\n * @param {Object} param.element details the update details.\n */\n _refreshCm({element}) {\n // Update classes.\n this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false);\n this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);\n this.locked = element.locked;\n }\n}\n"],"file":"cmitem.min.js"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/local/courseindex/cm.js"],"names":["Component","name","selectors","CM_NAME","classes","CMHIDDEN","LOCKED","id","element","dataset","configDragDrop","watch","handler","remove","_refreshCm","classList","toggle","visible","getElement","innerHTML","DRAGGING","dragging","locked","target","document","getElementById","DndCmItem"],"mappings":"2MA0BA,uD,+nDAEqBA,CAAAA,C,+HAKR,CAEL,KAAKC,IAAL,CAAY,gBAAZ,CAEA,KAAKC,SAAL,CAAiB,CACbC,OAAO,uBADM,CAAjB,CAIA,KAAKC,OAAL,CAAe,CACXC,QAAQ,CAAE,QADC,CAEXC,MAAM,CAAE,gBAFG,CAAf,CAKA,KAAKC,EAAL,CAAU,KAAKC,OAAL,CAAaC,OAAb,CAAqBF,EAClC,C,+CAmBY,CACT,KAAKG,cAAL,CAAoB,KAAKH,EAAzB,CACH,C,iDAOa,CACV,MAAO,CACH,CAACI,KAAK,cAAQ,KAAKJ,EAAb,aAAN,CAAkCK,OAAO,CAAE,KAAKC,MAAhD,CADG,CAEH,CAACF,KAAK,cAAQ,KAAKJ,EAAb,aAAN,CAAkCK,OAAO,CAAE,KAAKE,UAAhD,CAFG,CAIV,C,gDAOqB,SAAVN,CAAU,GAAVA,OAAU,CAElB,KAAKA,OAAL,CAAaO,SAAb,CAAuBC,MAAvB,CAA8B,KAAKZ,OAAL,CAAaC,QAA3C,CAAqD,CAACG,CAAO,CAACS,OAA9D,EACA,KAAKC,UAAL,CAAgB,KAAKhB,SAAL,CAAeC,OAA/B,EAAwCgB,SAAxC,CAAoDX,CAAO,CAACP,IAA5D,CACA,KAAKO,OAAL,CAAaO,SAAb,CAAuBC,MAAvB,CAA8B,KAAKZ,OAAL,CAAagB,QAA3C,WAAqDZ,CAAO,CAACa,QAA7D,oBACA,KAAKb,OAAL,CAAaO,SAAb,CAAuBC,MAAvB,CAA8B,KAAKZ,OAAL,CAAaE,MAA3C,WAAmDE,CAAO,CAACc,MAA3D,oBACA,KAAKA,MAAL,CAAcd,CAAO,CAACc,MACzB,C,oCAtCWC,C,CAAQrB,C,CAAW,CAC3B,MAAO,IAAIF,CAAAA,CAAJ,CAAc,CACjBQ,OAAO,CAAEgB,QAAQ,CAACC,cAAT,CAAwBF,CAAxB,CADQ,CAEjBrB,SAAS,CAATA,CAFiB,CAAd,CAIV,C,cAjCkCwB,S","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 * Course index cm component.\n *\n * This component is used to control specific course modules interactions like drag and drop.\n *\n * @module core_courseformat/local/courseindex/cm\n * @class core_courseformat/local/courseindex/cm\n * @copyright 2021 Ferran Recio <ferran@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport DndCmItem from 'core_courseformat/local/courseeditor/dndcmitem';\n\nexport default class Component extends DndCmItem {\n\n /**\n * Constructor hook.\n */\n create() {\n // Optional component name for debugging.\n this.name = 'courseindex_cm';\n // Default query selectors.\n this.selectors = {\n CM_NAME: `[data-for='cm_name']`,\n };\n // Default classes to toggle on refresh.\n this.classes = {\n CMHIDDEN: 'dimmed',\n LOCKED: 'editinprogress',\n };\n // We need our id to watch specific events.\n this.id = this.element.dataset.id;\n }\n\n /**\n * Static method to create a component instance form the mustache template.\n *\n * @param {element|string} target the DOM main element or its ID\n * @param {object} selectors optional css selector overrides\n * @return {Component}\n */\n static init(target, selectors) {\n return new Component({\n element: document.getElementById(target),\n selectors,\n });\n }\n\n /**\n * Initial state ready method.\n */\n stateReady() {\n this.configDragDrop(this.id);\n }\n\n /**\n * Component watchers.\n *\n * @returns {Array} of watchers\n */\n getWatchers() {\n return [\n {watch: `cm[${this.id}]:deleted`, handler: this.remove},\n {watch: `cm[${this.id}]:updated`, handler: this._refreshCm},\n ];\n }\n\n /**\n * Update a course index cm using the state information.\n *\n * @param {Object} details the update details.\n */\n _refreshCm({element}) {\n // Update classes.\n this.element.classList.toggle(this.classes.CMHIDDEN, !element.visible);\n this.getElement(this.selectors.CM_NAME).innerHTML = element.name;\n this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false);\n this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);\n this.locked = element.locked;\n }\n\n}\n"],"file":"cm.min.js"}
|
||||
{"version":3,"sources":["../../../src/local/courseindex/cm.js"],"names":["Component","name","selectors","CM_NAME","classes","CMHIDDEN","LOCKED","id","element","dataset","configDragDrop","watch","handler","remove","_refreshCm","classList","toggle","visible","getElement","innerHTML","DRAGGING","dragging","locked","target","document","getElementById","DndCmItem"],"mappings":"2MA0BA,uD,+nDAEqBA,CAAAA,C,+HAKR,CAEL,KAAKC,IAAL,CAAY,gBAAZ,CAEA,KAAKC,SAAL,CAAiB,CACbC,OAAO,uBADM,CAAjB,CAIA,KAAKC,OAAL,CAAe,CACXC,QAAQ,CAAE,QADC,CAEXC,MAAM,CAAE,gBAFG,CAAf,CAKA,KAAKC,EAAL,CAAU,KAAKC,OAAL,CAAaC,OAAb,CAAqBF,EAClC,C,+CAmBY,CACT,KAAKG,cAAL,CAAoB,KAAKH,EAAzB,CACH,C,iDAOa,CACV,MAAO,CACH,CAACI,KAAK,cAAQ,KAAKJ,EAAb,aAAN,CAAkCK,OAAO,CAAE,KAAKC,MAAhD,CADG,CAEH,CAACF,KAAK,cAAQ,KAAKJ,EAAb,aAAN,CAAkCK,OAAO,CAAE,KAAKE,UAAhD,CAFG,CAIV,C,gDAQqB,SAAVN,CAAU,GAAVA,OAAU,CAElB,KAAKA,OAAL,CAAaO,SAAb,CAAuBC,MAAvB,CAA8B,KAAKZ,OAAL,CAAaC,QAA3C,CAAqD,CAACG,CAAO,CAACS,OAA9D,EACA,KAAKC,UAAL,CAAgB,KAAKhB,SAAL,CAAeC,OAA/B,EAAwCgB,SAAxC,CAAoDX,CAAO,CAACP,IAA5D,CACA,KAAKO,OAAL,CAAaO,SAAb,CAAuBC,MAAvB,CAA8B,KAAKZ,OAAL,CAAagB,QAA3C,WAAqDZ,CAAO,CAACa,QAA7D,oBACA,KAAKb,OAAL,CAAaO,SAAb,CAAuBC,MAAvB,CAA8B,KAAKZ,OAAL,CAAaE,MAA3C,WAAmDE,CAAO,CAACc,MAA3D,oBACA,KAAKA,MAAL,CAAcd,CAAO,CAACc,MACzB,C,oCAvCWC,C,CAAQrB,C,CAAW,CAC3B,MAAO,IAAIF,CAAAA,CAAJ,CAAc,CACjBQ,OAAO,CAAEgB,QAAQ,CAACC,cAAT,CAAwBF,CAAxB,CADQ,CAEjBrB,SAAS,CAATA,CAFiB,CAAd,CAIV,C,cAjCkCwB,S","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 * Course index cm component.\n *\n * This component is used to control specific course modules interactions like drag and drop.\n *\n * @module core_courseformat/local/courseindex/cm\n * @class core_courseformat/local/courseindex/cm\n * @copyright 2021 Ferran Recio <ferran@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport DndCmItem from 'core_courseformat/local/courseeditor/dndcmitem';\n\nexport default class Component extends DndCmItem {\n\n /**\n * Constructor hook.\n */\n create() {\n // Optional component name for debugging.\n this.name = 'courseindex_cm';\n // Default query selectors.\n this.selectors = {\n CM_NAME: `[data-for='cm_name']`,\n };\n // Default classes to toggle on refresh.\n this.classes = {\n CMHIDDEN: 'dimmed',\n LOCKED: 'editinprogress',\n };\n // We need our id to watch specific events.\n this.id = this.element.dataset.id;\n }\n\n /**\n * Static method to create a component instance form the mustache template.\n *\n * @param {element|string} target the DOM main element or its ID\n * @param {object} selectors optional css selector overrides\n * @return {Component}\n */\n static init(target, selectors) {\n return new Component({\n element: document.getElementById(target),\n selectors,\n });\n }\n\n /**\n * Initial state ready method.\n */\n stateReady() {\n this.configDragDrop(this.id);\n }\n\n /**\n * Component watchers.\n *\n * @returns {Array} of watchers\n */\n getWatchers() {\n return [\n {watch: `cm[${this.id}]:deleted`, handler: this.remove},\n {watch: `cm[${this.id}]:updated`, handler: this._refreshCm},\n ];\n }\n\n /**\n * Update a course index cm using the state information.\n *\n * @param {object} param\n * @param {Object} param.element details the update details.\n */\n _refreshCm({element}) {\n // Update classes.\n this.element.classList.toggle(this.classes.CMHIDDEN, !element.visible);\n this.getElement(this.selectors.CM_NAME).innerHTML = element.name;\n this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false);\n this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);\n this.locked = element.locked;\n }\n\n}\n"],"file":"cm.min.js"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -53,8 +53,8 @@ function dispatchStateChangedEvent(detail, target) {
|
||||
*
|
||||
* @param {number} courseId the course id
|
||||
* @param {setup} setup format, page and course settings
|
||||
* @property {boolean} setup.editing if the page is in edit mode
|
||||
* @property {boolean} setup.supportscomponents if the format supports components for content
|
||||
* @param {boolean} setup.editing if the page is in edit mode
|
||||
* @param {boolean} setup.supportscomponents if the format supports components for content
|
||||
*/
|
||||
export const setViewFormat = (courseId, setup) => {
|
||||
const editor = getCourseEditor(courseId);
|
||||
|
@ -182,7 +182,8 @@ export default class Component extends BaseComponent {
|
||||
* Most course module HTML is still strongly backend dependant.
|
||||
* Some changes require to get a new version af the module.
|
||||
*
|
||||
* @param {Object} update the state update data
|
||||
* @param {Object} param
|
||||
* @param {Object} param.element update the state update data
|
||||
*/
|
||||
_reloadCm({element}) {
|
||||
const cmitem = this.getElement(this.selectors.CM, element.id);
|
||||
@ -194,7 +195,8 @@ export default class Component extends BaseComponent {
|
||||
/**
|
||||
* Update section collapsed.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {object} args
|
||||
* @param {Object} args.element The element to update
|
||||
*/
|
||||
_refreshSectionCollapsed({element}) {
|
||||
const target = this.getElement(this.selectors.SECTION, element.id);
|
||||
@ -234,7 +236,8 @@ export default class Component extends BaseComponent {
|
||||
* Course formats can override the section title rendering so the frontend depends heavily on backend
|
||||
* rendering. Luckily in edit mode we can trigger a title update using the inplace_editable module.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {Object} param
|
||||
* @param {Object} param.element details the update details.
|
||||
*/
|
||||
_refreshSectionNumber({element}) {
|
||||
// Find the element.
|
||||
@ -272,8 +275,8 @@ export default class Component extends BaseComponent {
|
||||
/**
|
||||
* Refresh a section cm list.
|
||||
*
|
||||
* @param {details} details the update details
|
||||
* @property {object} details.element the state object
|
||||
* @param {Object} param
|
||||
* @param {Object} param.element details the update details.
|
||||
*/
|
||||
_refreshSectionCmlist({element}) {
|
||||
const cmlist = element.cmlist ?? [];
|
||||
@ -289,7 +292,8 @@ export default class Component extends BaseComponent {
|
||||
/**
|
||||
* Refresh the section list.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {Object} param
|
||||
* @param {Object} param.element details the update details.
|
||||
*/
|
||||
_refreshCourseSectionlist({element}) {
|
||||
const sectionlist = element.sectionlist ?? [];
|
||||
@ -361,8 +365,8 @@ export default class Component extends BaseComponent {
|
||||
* Most course module HTML is still strongly backend dependant.
|
||||
* Some changes require to get a new version of the module.
|
||||
*
|
||||
* @param {details} param0 the watcher details
|
||||
* @property {object} param0.element the state object
|
||||
* @param {object} param0 the watcher details
|
||||
* @param {object} param0.element the state object
|
||||
*/
|
||||
_reloadCm({element}) {
|
||||
const cmitem = this.getElement(this.selectors.CM, element.id);
|
||||
|
@ -98,7 +98,8 @@ export default class extends DndSection {
|
||||
/**
|
||||
* Update a course index section using the state information.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {object} param
|
||||
* @param {Object} param.element details the update details.
|
||||
*/
|
||||
_refreshSection({element}) {
|
||||
// Update classes.
|
||||
|
@ -69,7 +69,8 @@ export default class extends DndCmItem {
|
||||
/**
|
||||
* Update a course index cm using the state information.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {object} param
|
||||
* @param {Object} param.element details the update details.
|
||||
*/
|
||||
_refreshCm({element}) {
|
||||
// Update classes.
|
||||
@ -77,4 +78,4 @@ export default class extends DndCmItem {
|
||||
this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);
|
||||
this.locked = element.locked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ export default class extends Reactive {
|
||||
* Setup the current view settings
|
||||
*
|
||||
* @param {Object} setup format, page and course settings
|
||||
* @property {boolean} setup.editing if the page is in edit mode
|
||||
* @property {boolean} setup.supportscomponents if the format supports components for content
|
||||
* @param {boolean} setup.editing if the page is in edit mode
|
||||
* @param {boolean} setup.supportscomponents if the format supports components for content
|
||||
*/
|
||||
setViewFormat(setup) {
|
||||
this._editing = setup.editing ?? false;
|
||||
@ -213,8 +213,7 @@ export default class extends Reactive {
|
||||
* goes wrong. However, course editor can directly display a notification.
|
||||
*
|
||||
* @method dispatch
|
||||
* @param {string} actionName the action name (usually the mutation name)
|
||||
* @param {*} param any number of params the mutation needs.
|
||||
* @param {mixed} args any number of params the mutation needs.
|
||||
*/
|
||||
async dispatch(...args) {
|
||||
try {
|
||||
|
@ -119,8 +119,6 @@ export default class extends BaseComponent {
|
||||
|
||||
/**
|
||||
* Display the component dropzone.
|
||||
*
|
||||
* @param {Object} dropdata the accepted drop data
|
||||
*/
|
||||
showDropZone() {
|
||||
this.element.classList.add(this.classes.DROPZONE);
|
||||
|
@ -285,10 +285,10 @@ export default class {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full updated state data of the course.
|
||||
*
|
||||
* @param {StateManager} stateManager the current state
|
||||
*/
|
||||
* Get the full updated state data of the course.
|
||||
*
|
||||
* @param {StateManager} stateManager the current state
|
||||
*/
|
||||
async courseState(stateManager) {
|
||||
const course = stateManager.get('course');
|
||||
const updates = await this._callEditWebservice('course_state', course.id);
|
||||
|
@ -83,7 +83,8 @@ export default class Component extends DndCmItem {
|
||||
/**
|
||||
* Update a course index cm using the state information.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {object} param
|
||||
* @param {Object} param.element details the update details.
|
||||
*/
|
||||
_refreshCm({element}) {
|
||||
// Update classes.
|
||||
|
@ -133,7 +133,8 @@ export default class Component extends BaseComponent {
|
||||
/**
|
||||
* Update section collapsed.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {object} args
|
||||
* @param {object} args.element The leement to be expanded
|
||||
*/
|
||||
_refreshSectionCollapsed({element}) {
|
||||
const target = this.getElement(this.selectors.SECTION, element.id);
|
||||
@ -186,7 +187,9 @@ export default class Component extends BaseComponent {
|
||||
/**
|
||||
* Create a newcm instance.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {object} param
|
||||
* @param {Object} param.state
|
||||
* @param {Object} param.element
|
||||
*/
|
||||
async _createCm({state, element}) {
|
||||
// Create a fake node while the component is loading.
|
||||
@ -213,7 +216,8 @@ export default class Component extends BaseComponent {
|
||||
/**
|
||||
* Refresh a section cm list.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {object} param
|
||||
* @param {Object} param.element
|
||||
*/
|
||||
_refreshSectionCmlist({element}) {
|
||||
const cmlist = element.cmlist ?? [];
|
||||
@ -224,7 +228,8 @@ export default class Component extends BaseComponent {
|
||||
/**
|
||||
* Refresh the section list.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {object} param
|
||||
* @param {Object} param.element
|
||||
*/
|
||||
_refreshCourseSectionlist({element}) {
|
||||
const sectionlist = element.sectionlist ?? [];
|
||||
@ -274,7 +279,8 @@ export default class Component extends BaseComponent {
|
||||
*
|
||||
* The actual DOM element removal is delegated to the cm component.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {object} param
|
||||
* @param {Object} param.element
|
||||
*/
|
||||
_deleteCm({element}) {
|
||||
delete this.cms[element.id];
|
||||
|
@ -108,7 +108,8 @@ export default class Component extends DndSection {
|
||||
/**
|
||||
* Update a course index section using the state information.
|
||||
*
|
||||
* @param {Object} details the update details.
|
||||
* @param {Object} param details the update details.
|
||||
* @param {Object} param.element
|
||||
*/
|
||||
_refreshSection({element}) {
|
||||
// Update classes.
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/point.js"],"names":["fetchCurrentGrade","storeCurrentGrade","component","context","itemname","userId","notifyUser","rootNode","form","querySelector","grade","checkValidity","value","trim","invalidResult","serialize"],"mappings":"8RA0BA,uD,mVAaiC,QAApBA,CAAAA,iBAAoB,SAAa,iBAAW,OAAX,yBAAb,C,CAc1B,GAAMC,CAAAA,CAAiB,4CAAG,WAAMC,CAAN,CAAiBC,CAAjB,CAA0BC,CAA1B,CAAoCC,CAApC,CAA4CC,CAA5C,CAAwDC,CAAxD,2FACvBC,CADuB,CAChBD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADgB,CAEvBC,CAFuB,CAEfF,CAAI,CAACC,aAAL,CAAmB,uBAAnB,CAFe,MAIzB,CAACC,CAAK,CAACC,aAAN,EAAD,EAA0B,CAACD,CAAK,CAACE,KAAN,CAAYC,IAAZ,EAJF,2CAKlBC,eALkB,cAQzB,uBAAYN,CAAZ,CARyB,kCASZ,gBAAU,OAAV,EAAmBN,CAAnB,CAA8BC,CAA9B,CAAuCC,CAAvC,CAAiDC,CAAjD,CAAyDC,CAAzD,CAAqE,cAAOE,CAAP,EAAaO,SAAb,EAArE,CATY,0EAWlB,EAXkB,2CAAH,uDAAvB,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\n/**\n * Grading panel for simple direct grading.\n *\n * @module core_grades/grades/grader/gradingpanel/point\n * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {saveGrade, fetchGrade} from './repository';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\nimport {invalidResult} from './normalise';\n\n/**\n * Fetch the current grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Element} rootNode\n * @return {Object}\n */\nexport const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);\n\n/**\n * Store a new grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Boolean} notifyUser\n * @param {Element} rootNode\n *\n * @return {Object}\n */\nexport const storeCurrentGrade = async(component, context, itemname, userId, notifyUser, rootNode) => {\n const form = rootNode.querySelector('form');\n const grade = form.querySelector('input[name=\"grade\"]');\n\n if (!grade.checkValidity() || !grade.value.trim()) {\n return invalidResult;\n }\n\n if (compareData(form) === true) {\n return await saveGrade('point')(component, context, itemname, userId, notifyUser, jQuery(form).serialize());\n } else {\n return '';\n }\n};\n"],"file":"point.min.js"}
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/point.js"],"names":["fetchCurrentGrade","storeCurrentGrade","component","context","itemname","userId","notifyUser","rootNode","form","querySelector","grade","checkValidity","value","trim","invalidResult","serialize"],"mappings":"8RA0BA,uD,mVAciC,QAApBA,CAAAA,iBAAoB,SAAa,iBAAW,OAAX,yBAAb,C,CAa1B,GAAMC,CAAAA,CAAiB,4CAAG,WAAMC,CAAN,CAAiBC,CAAjB,CAA0BC,CAA1B,CAAoCC,CAApC,CAA4CC,CAA5C,CAAwDC,CAAxD,2FACvBC,CADuB,CAChBD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADgB,CAEvBC,CAFuB,CAEfF,CAAI,CAACC,aAAL,CAAmB,uBAAnB,CAFe,MAIzB,CAACC,CAAK,CAACC,aAAN,EAAD,EAA0B,CAACD,CAAK,CAACE,KAAN,CAAYC,IAAZ,EAJF,2CAKlBC,eALkB,cAQzB,uBAAYN,CAAZ,CARyB,kCASZ,gBAAU,OAAV,EAAmBN,CAAnB,CAA8BC,CAA9B,CAAuCC,CAAvC,CAAiDC,CAAjD,CAAyDC,CAAzD,CAAqE,cAAOE,CAAP,EAAaO,SAAb,EAArE,CATY,0EAWlB,EAXkB,2CAAH,uDAAvB,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\n/**\n * Grading panel for simple direct grading.\n *\n * @module core_grades/grades/grader/gradingpanel/point\n * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {saveGrade, fetchGrade} from './repository';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\nimport {invalidResult} from './normalise';\n\n/**\n * Fetch the current grade for a user.\n *\n * @param {object} args\n * @param {String} args.component\n * @param {Number} args.context\n * @param {String} args.itemname\n * @param {Number} args.userId\n * @param {Element} args.rootNode\n * @returns {Object}\n */\nexport const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);\n\n/**\n * Store a new grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Boolean} notifyUser\n * @param {Element} rootNode\n * @returns {Object}\n */\nexport const storeCurrentGrade = async(component, context, itemname, userId, notifyUser, rootNode) => {\n const form = rootNode.querySelector('form');\n const grade = form.querySelector('input[name=\"grade\"]');\n\n if (!grade.checkValidity() || !grade.value.trim()) {\n return invalidResult;\n }\n\n if (compareData(form) === true) {\n return await saveGrade('point')(component, context, itemname, userId, notifyUser, jQuery(form).serialize());\n } else {\n return '';\n }\n};\n"],"file":"point.min.js"}
|
@ -30,12 +30,13 @@ import {invalidResult} from './normalise';
|
||||
/**
|
||||
* Fetch the current grade for a user.
|
||||
*
|
||||
* @param {String} component
|
||||
* @param {Number} context
|
||||
* @param {String} itemname
|
||||
* @param {Number} userId
|
||||
* @param {Element} rootNode
|
||||
* @return {Object}
|
||||
* @param {object} args
|
||||
* @param {String} args.component
|
||||
* @param {Number} args.context
|
||||
* @param {String} args.itemname
|
||||
* @param {Number} args.userId
|
||||
* @param {Element} args.rootNode
|
||||
* @returns {Object}
|
||||
*/
|
||||
export const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);
|
||||
|
||||
@ -48,8 +49,7 @@ export const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);
|
||||
* @param {Number} userId
|
||||
* @param {Boolean} notifyUser
|
||||
* @param {Element} rootNode
|
||||
*
|
||||
* @return {Object}
|
||||
* @returns {Object}
|
||||
*/
|
||||
export const storeCurrentGrade = async(component, context, itemname, userId, notifyUser, rootNode) => {
|
||||
const form = rootNode.querySelector('form');
|
||||
|
File diff suppressed because one or more lines are too long
@ -19,7 +19,7 @@
|
||||
* @module gradingform_guide/comment_chooser
|
||||
* @copyright 2015 Jun Pataleta <jun@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
*/
|
||||
define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function($, templates, notification) {
|
||||
|
||||
// Private variables and functions.
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/local/repository/dynamic_tabs.js"],"names":["getContent","tab","jsondata","Ajax","call","methodname","args"],"mappings":"qKAuBA,uDASO,GAAMA,CAAAA,CAAU,CAAG,SAACC,CAAD,CAAMC,CAAN,CAAmB,CAMzC,MAAOC,WAAKC,IAAL,CAAU,CALD,CACZC,UAAU,CAAE,+BADA,CAEZC,IAAI,CAAE,CAACL,GAAG,CAAEA,CAAN,CAAWC,QAAQ,CAAEA,CAArB,CAFM,CAKC,CAAV,EAAqB,CAArB,CACV,CAPM,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\n/**\n* Module to handle dynamic tabs AJAX requests\n*\n* @module core/local/repository/dynamic_tabs\n* @copyright 2021 David Matamoros <davidmc@moodle.com>\n* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n*/\n\nimport Ajax from 'core/ajax';\n\n/**\n* Return tab content\n*\n* @param {String} tab\n* @param {String} jsondata\n* @return {Promise}\n*/\nexport const getContent = (tab, jsondata) => {\n const request = {\n methodname: 'core_dynamic_tabs_get_content',\n args: {tab: tab, jsondata: jsondata}\n };\n\n return Ajax.call([request])[0];\n};\n"],"file":"dynamic_tabs.min.js"}
|
||||
{"version":3,"sources":["../../../src/local/repository/dynamic_tabs.js"],"names":["getContent","tab","jsondata","Ajax","call","methodname","args"],"mappings":"qKAuBA,uDASO,GAAMA,CAAAA,CAAU,CAAG,SAACC,CAAD,CAAMC,CAAN,CAAmB,CAMzC,MAAOC,WAAKC,IAAL,CAAU,CALD,CACZC,UAAU,CAAE,+BADA,CAEZC,IAAI,CAAE,CAACL,GAAG,CAAEA,CAAN,CAAWC,QAAQ,CAAEA,CAArB,CAFM,CAKC,CAAV,EAAqB,CAArB,CACV,CAPM,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\n/**\n * Module to handle dynamic tabs AJAX requests\n *\n * @module core/local/repository/dynamic_tabs\n * @copyright 2021 David Matamoros <davidmc@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\n\n/**\n * Return tab content\n *\n * @param {String} tab\n * @param {String} jsondata\n * @return {Promise}\n */\nexport const getContent = (tab, jsondata) => {\n const request = {\n methodname: 'core_dynamic_tabs_get_content',\n args: {tab: tab, jsondata: jsondata}\n };\n\n return Ajax.call([request])[0];\n};\n"],"file":"dynamic_tabs.min.js"}
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/utils.js"],"names":["throttle","func","wait","onCooldown","runAgain","run","args","apply","setTimeout","recurse","debounce","timeout","clearTimeout"],"mappings":"mJAoCwB,QAAXA,CAAAA,QAAW,CAACC,CAAD,CAAOC,CAAP,CAAgB,IAChCC,CAAAA,CAAU,GADsB,CAEhCC,CAAQ,CAAG,IAFqB,CAG9BC,CAAG,CAAG,UAAkB,4BAANC,CAAM,uBAANA,CAAM,iBAC1B,GAAiB,IAAb,GAAAF,CAAJ,CAAuB,CAEnBA,CAAQ,GACX,CAHD,IAGO,CAGHA,CAAQ,GACX,CAED,GAAID,CAAJ,CAAgB,CAEZ,MACH,CAEDF,CAAI,CAACM,KAAL,CAAW,IAAX,CAAiBD,CAAjB,EACAH,CAAU,GAAV,CAEAK,UAAU,CAAC,UAAM,CACb,GAAMC,CAAAA,CAAO,CAAGL,CAAhB,CACAD,CAAU,GAAV,CACAC,CAAQ,CAAG,IAAX,CAEA,GAAIK,CAAJ,CAAa,CACTJ,CAAG,CAACC,CAAD,CACN,CACJ,CARS,CAQPJ,CARO,CASb,CA9BmC,CAgCpC,MAAOG,CAAAA,CACV,C,YAYuB,QAAXK,CAAAA,QAAW,CAACT,CAAD,CAAOC,CAAP,CAAgB,CACpC,GAAIS,CAAAA,CAAO,CAAG,IAAd,CACA,MAAO,WAAkB,mCAANL,CAAM,uBAANA,CAAM,iBACrBM,YAAY,CAACD,CAAD,CAAZ,CACAA,CAAO,CAAGH,UAAU,CAAC,UAAM,CACvBP,CAAI,CAACM,KAAL,CAAW,CAAX,CAAiBD,CAAjB,CACH,CAFmB,CAEjBJ,CAFiB,CAGvB,CACJ,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\n/**\n * Utility functions.\n *\n * @module core/utils\n * @copyright 2019 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n /**\n * Create a wrapper function to throttle the execution of the given\n * function to at most once every specified period.\n *\n * If the function is attempted to be executed while it's in cooldown\n * (during the wait period) then it'll immediately execute again as\n * soon as the cooldown is over.\n *\n * @method\n * @param {Function} func The function to throttle\n * @param {Number} wait The number of milliseconds to wait between executions\n * @return {Function}\n */\nexport const throttle = (func, wait) => {\n let onCooldown = false;\n let runAgain = null;\n const run = function(...args) {\n if (runAgain === null) {\n // This is the first time the function has been called.\n runAgain = false;\n } else {\n // This function has been called a second time during the wait period\n // so re-run it once the wait period is over.\n runAgain = true;\n }\n\n if (onCooldown) {\n // Function has already run for this wait period.\n return;\n }\n\n func.apply(this, args);\n onCooldown = true;\n\n setTimeout(() => {\n const recurse = runAgain;\n onCooldown = false;\n runAgain = null;\n\n if (recurse) {\n run(args);\n }\n }, wait);\n };\n\n return run;\n};\n\n/**\n * Create a wrapper function to debounce the execution of the given\n * function. Each attempt to execute the function will reset the cooldown\n * period.\n *\n * @method\n * @param {Function} func The function to debounce\n * @param {Number} wait The number of milliseconds to wait after the final attempt to execute\n * @return {Function}\n */\nexport const debounce = (func, wait) => {\n let timeout = null;\n return function(...args) {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n func.apply(this, args);\n }, wait);\n };\n};\n"],"file":"utils.min.js"}
|
||||
{"version":3,"sources":["../src/utils.js"],"names":["throttle","func","wait","onCooldown","runAgain","run","args","apply","setTimeout","recurse","debounce","timeout","clearTimeout"],"mappings":"mJAqCwB,QAAXA,CAAAA,QAAW,CAACC,CAAD,CAAOC,CAAP,CAAgB,IAChCC,CAAAA,CAAU,GADsB,CAEhCC,CAAQ,CAAG,IAFqB,CAG9BC,CAAG,CAAG,UAAkB,4BAANC,CAAM,uBAANA,CAAM,iBAC1B,GAAiB,IAAb,GAAAF,CAAJ,CAAuB,CAEnBA,CAAQ,GACX,CAHD,IAGO,CAGHA,CAAQ,GACX,CAED,GAAID,CAAJ,CAAgB,CAEZ,MACH,CAEDF,CAAI,CAACM,KAAL,CAAW,IAAX,CAAiBD,CAAjB,EACAH,CAAU,GAAV,CAEAK,UAAU,CAAC,UAAM,CACb,GAAMC,CAAAA,CAAO,CAAGL,CAAhB,CACAD,CAAU,GAAV,CACAC,CAAQ,CAAG,IAAX,CAEA,GAAIK,CAAJ,CAAa,CACTJ,CAAG,CAACC,CAAD,CACN,CACJ,CARS,CAQPJ,CARO,CASb,CA9BmC,CAgCpC,MAAOG,CAAAA,CACV,C,YAYuB,QAAXK,CAAAA,QAAW,CAACT,CAAD,CAAOC,CAAP,CAAgB,CACpC,GAAIS,CAAAA,CAAO,CAAG,IAAd,CACA,MAAO,WAAkB,mCAANL,CAAM,uBAANA,CAAM,iBACrBM,YAAY,CAACD,CAAD,CAAZ,CACAA,CAAO,CAAGH,UAAU,CAAC,UAAM,CACvBP,CAAI,CAACM,KAAL,CAAW,CAAX,CAAiBD,CAAjB,CACH,CAFmB,CAEjBJ,CAFiB,CAGvB,CACJ,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\n/**\n * Utility functions.\n *\n * @module core/utils\n * @copyright 2019 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n /**\n * Create a wrapper function to throttle the execution of the given\n *\n * function to at most once every specified period.\n *\n * If the function is attempted to be executed while it's in cooldown\n * (during the wait period) then it'll immediately execute again as\n * soon as the cooldown is over.\n *\n * @method\n * @param {Function} func The function to throttle\n * @param {Number} wait The number of milliseconds to wait between executions\n * @return {Function}\n */\nexport const throttle = (func, wait) => {\n let onCooldown = false;\n let runAgain = null;\n const run = function(...args) {\n if (runAgain === null) {\n // This is the first time the function has been called.\n runAgain = false;\n } else {\n // This function has been called a second time during the wait period\n // so re-run it once the wait period is over.\n runAgain = true;\n }\n\n if (onCooldown) {\n // Function has already run for this wait period.\n return;\n }\n\n func.apply(this, args);\n onCooldown = true;\n\n setTimeout(() => {\n const recurse = runAgain;\n onCooldown = false;\n runAgain = null;\n\n if (recurse) {\n run(args);\n }\n }, wait);\n };\n\n return run;\n};\n\n/**\n * Create a wrapper function to debounce the execution of the given\n * function. Each attempt to execute the function will reset the cooldown\n * period.\n *\n * @method\n * @param {Function} func The function to debounce\n * @param {Number} wait The number of milliseconds to wait after the final attempt to execute\n * @return {Function}\n */\nexport const debounce = (func, wait) => {\n let timeout = null;\n return function(...args) {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n func.apply(this, args);\n }, wait);\n };\n};\n"],"file":"utils.min.js"}
|
@ -73,7 +73,7 @@ const registerListenerEvents = (pageType, pageLayout, addBlockUrl) => {
|
||||
* Method that creates the 'add block' modal.
|
||||
*
|
||||
* @method buildAddBlockModal
|
||||
* @return {Promise} The modal promise (modal's body will be rendered later).
|
||||
* @returns {Promise} The modal promise (modal's body will be rendered later).
|
||||
*/
|
||||
const buildAddBlockModal = () => {
|
||||
return ModalFactory.create({
|
||||
|
@ -184,7 +184,6 @@ define([
|
||||
* Make the config config.
|
||||
*
|
||||
* @protected
|
||||
* @param {module:core/chart_axis} axis The axis.
|
||||
* @return {Object} The axis config.
|
||||
*/
|
||||
Output.prototype._makeConfig = function() {
|
||||
|
@ -47,10 +47,10 @@ const reactiveDebuggers = {};
|
||||
class Debug extends Reactive {
|
||||
|
||||
/**
|
||||
* Set the initial state.
|
||||
*
|
||||
* @param {object} stateData the initial state data.
|
||||
*/
|
||||
* Set the initial state.
|
||||
*
|
||||
* @param {object} stateData the initial state data.
|
||||
*/
|
||||
setInitialState(stateData) {
|
||||
super.setInitialState(stateData);
|
||||
log.debug(`Debug module "M.reactive" loaded.`);
|
||||
@ -206,7 +206,7 @@ class DebugInstance {
|
||||
*
|
||||
* Quick access to the instance setReadOnly method.
|
||||
*
|
||||
* @param {bool} value: the new read only value
|
||||
* @param {bool} value the new read only value
|
||||
*/
|
||||
set readOnly(value) {
|
||||
this.instance.stateManager.setReadOnly(value);
|
||||
@ -215,7 +215,7 @@ class DebugInstance {
|
||||
/**
|
||||
* Get the read only value
|
||||
*
|
||||
* @return {bool}
|
||||
* @returns {bool}
|
||||
*/
|
||||
get readOnly() {
|
||||
return this.instance.stateManager.readonly;
|
||||
@ -224,7 +224,7 @@ class DebugInstance {
|
||||
/**
|
||||
* Return the current state object.
|
||||
*
|
||||
* @return {object}
|
||||
* @returns {object}
|
||||
*/
|
||||
get state() {
|
||||
return this.instance.state;
|
||||
@ -246,7 +246,7 @@ class DebugInstance {
|
||||
/**
|
||||
* Get the current highligh value.
|
||||
*
|
||||
* @return {bool}
|
||||
* @returns {bool}
|
||||
*/
|
||||
get highlight() {
|
||||
return this.instance._reactiveDebugData.highlighted;
|
||||
@ -255,7 +255,7 @@ class DebugInstance {
|
||||
/**
|
||||
* List all the components registered in this instance.
|
||||
*
|
||||
* @return {array}
|
||||
* @returns {array}
|
||||
*/
|
||||
get components() {
|
||||
return [...this.instance.components];
|
||||
@ -264,7 +264,7 @@ class DebugInstance {
|
||||
/**
|
||||
* List all the state changes evenet pending to dispatch.
|
||||
*
|
||||
* @return {array}
|
||||
* @returns {array}
|
||||
*/
|
||||
get changes() {
|
||||
const result = [];
|
||||
@ -283,8 +283,7 @@ class DebugInstance {
|
||||
* goes wrong. However, course editor can directly display a notification.
|
||||
*
|
||||
* @method dispatch
|
||||
* @param {string} actionName the action name (usually the mutation name)
|
||||
* @param {*} param any number of params the mutation needs.
|
||||
* @param {*} args
|
||||
*/
|
||||
async dispatch(...args) {
|
||||
this.instance.dispatch(...args);
|
||||
@ -293,7 +292,7 @@ class DebugInstance {
|
||||
/**
|
||||
* Return all the HTML elements registered in the instance components.
|
||||
*
|
||||
* @return {array}
|
||||
* @returns {array}
|
||||
*/
|
||||
get elements() {
|
||||
const result = [];
|
||||
@ -306,7 +305,7 @@ class DebugInstance {
|
||||
/**
|
||||
* Return a plain copy of the state data.
|
||||
*
|
||||
* @return {object}
|
||||
* @returns {object}
|
||||
*/
|
||||
get stateData() {
|
||||
return JSON.parse(JSON.stringify(this.state));
|
||||
|
@ -274,7 +274,8 @@ class DebugInstanceSubpanel extends BaseComponent {
|
||||
/**
|
||||
* Wtacher method to refresh the log panel.
|
||||
*
|
||||
* @param {object} detail of the change
|
||||
* @param {object} args
|
||||
* @param {HTMLElement} args.element
|
||||
*/
|
||||
_refreshLog({element}) {
|
||||
const list = element?.lastChanges ?? [];
|
||||
|
@ -137,24 +137,24 @@ export default class {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the initial state.
|
||||
*
|
||||
* @param {object} stateData the initial state data.
|
||||
*/
|
||||
* Set the initial state.
|
||||
*
|
||||
* @param {object} stateData the initial state data.
|
||||
*/
|
||||
setInitialState(stateData) {
|
||||
this.pendingState.resolve();
|
||||
this.stateManager.setInitialState(stateData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add individual functions to the mutations.
|
||||
*
|
||||
* Note new mutations will be added to the existing ones. To replace the full mutation
|
||||
* object with a new one, use setMutations method.
|
||||
*
|
||||
* @method addMutations
|
||||
* @param {Object} newFunctions an object with new mutation functions.
|
||||
*/
|
||||
* Add individual functions to the mutations.
|
||||
*
|
||||
* Note new mutations will be added to the existing ones. To replace the full mutation
|
||||
* object with a new one, use setMutations method.
|
||||
*
|
||||
* @method addMutations
|
||||
* @param {Object} newFunctions an object with new mutation functions.
|
||||
*/
|
||||
addMutations(newFunctions) {
|
||||
// Mutations can provide an init method to do some setup in the statemanager.
|
||||
if (newFunctions.init !== undefined) {
|
||||
@ -183,10 +183,10 @@ export default class {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current state.
|
||||
*
|
||||
* @return {object}
|
||||
*/
|
||||
* Return the current state.
|
||||
*
|
||||
* @return {object}
|
||||
*/
|
||||
get state() {
|
||||
return this.stateManager.state;
|
||||
}
|
||||
@ -206,42 +206,42 @@ export default class {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the initial state promise.
|
||||
*
|
||||
* Typically, components do not require to use this promise because registerComponent
|
||||
* will trigger their stateReady method automatically. But it could be useful for complex
|
||||
* components that require to combine state, template and string loadings.
|
||||
*
|
||||
* @method getState
|
||||
* @return {Promise}
|
||||
*/
|
||||
* Return the initial state promise.
|
||||
*
|
||||
* Typically, components do not require to use this promise because registerComponent
|
||||
* will trigger their stateReady method automatically. But it could be useful for complex
|
||||
* components that require to combine state, template and string loadings.
|
||||
*
|
||||
* @method getState
|
||||
* @return {Promise}
|
||||
*/
|
||||
getInitialStatePromise() {
|
||||
return this.stateManager.getInitialPromise();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new component.
|
||||
*
|
||||
* Component can provide some optional functions to the reactive module:
|
||||
* - getWatchers: returns an array of watchers
|
||||
* - stateReady: a method to call when the initial state is loaded
|
||||
*
|
||||
* It can also provide some optional attributes:
|
||||
* - name: the component name (default value: "Unkown component") to customize debug messages.
|
||||
*
|
||||
* The method will also use dispatchRegistrationSuccess and dispatchRegistrationFail. Those
|
||||
* are BaseComponent methods to inform parent components of the registration status.
|
||||
* Components should not override those methods.
|
||||
*
|
||||
* @method registerComponent
|
||||
* @param {object} component the new component
|
||||
* @property {string} [component.name] the component name to display in warnings and errors.
|
||||
* @property {Function} [component.dispatchRegistrationSuccess] method to notify registration success
|
||||
* @property {Function} [component.dispatchRegistrationFail] method to notify registration fail
|
||||
* @property {Function} [component.getWatchers] getter of the component watchers
|
||||
* @property {Function} [component.stateReady] method to call when the state is ready
|
||||
* @return {object} the registered component
|
||||
*/
|
||||
* Register a new component.
|
||||
*
|
||||
* Component can provide some optional functions to the reactive module:
|
||||
* - getWatchers: returns an array of watchers
|
||||
* - stateReady: a method to call when the initial state is loaded
|
||||
*
|
||||
* It can also provide some optional attributes:
|
||||
* - name: the component name (default value: "Unkown component") to customize debug messages.
|
||||
*
|
||||
* The method will also use dispatchRegistrationSuccess and dispatchRegistrationFail. Those
|
||||
* are BaseComponent methods to inform parent components of the registration status.
|
||||
* Components should not override those methods.
|
||||
*
|
||||
* @method registerComponent
|
||||
* @param {object} component the new component
|
||||
* @param {string} [component.name] the component name to display in warnings and errors.
|
||||
* @param {Function} [component.dispatchRegistrationSuccess] method to notify registration success
|
||||
* @param {Function} [component.dispatchRegistrationFail] method to notify registration fail
|
||||
* @param {Function} [component.getWatchers] getter of the component watchers
|
||||
* @param {Function} [component.stateReady] method to call when the state is ready
|
||||
* @return {object} the registered component
|
||||
*/
|
||||
registerComponent(component) {
|
||||
|
||||
// Component name is an optional attribute to customize debug messages.
|
||||
@ -360,16 +360,16 @@ export default class {
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a change in the state.
|
||||
*
|
||||
* This method is the only way for components to alter the state. Watchers will receive a
|
||||
* read only state to prevent illegal changes. If some user action require a state change, the
|
||||
* component should dispatch a mutation to trigger all the necessary logic to alter the state.
|
||||
*
|
||||
* @method dispatch
|
||||
* @param {string} actionName the action name (usually the mutation name)
|
||||
* @param {*} param any number of params the mutation needs.
|
||||
*/
|
||||
* Dispatch a change in the state.
|
||||
*
|
||||
* This method is the only way for components to alter the state. Watchers will receive a
|
||||
* read only state to prevent illegal changes. If some user action require a state change, the
|
||||
* component should dispatch a mutation to trigger all the necessary logic to alter the state.
|
||||
*
|
||||
* @method dispatch
|
||||
* @param {string} actionName the action name (usually the mutation name)
|
||||
* @param {mixed} params any number of params the mutation needs.
|
||||
*/
|
||||
async dispatch(actionName, ...params) {
|
||||
if (typeof actionName !== 'string') {
|
||||
throw new Error(`Dispatch action name must be a string`);
|
||||
|
@ -14,22 +14,22 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Module to handle dynamic tabs AJAX requests
|
||||
*
|
||||
* @module core/local/repository/dynamic_tabs
|
||||
* @copyright 2021 David Matamoros <davidmc@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
* Module to handle dynamic tabs AJAX requests
|
||||
*
|
||||
* @module core/local/repository/dynamic_tabs
|
||||
* @copyright 2021 David Matamoros <davidmc@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
import Ajax from 'core/ajax';
|
||||
|
||||
/**
|
||||
* Return tab content
|
||||
*
|
||||
* @param {String} tab
|
||||
* @param {String} jsondata
|
||||
* @return {Promise}
|
||||
*/
|
||||
* Return tab content
|
||||
*
|
||||
* @param {String} tab
|
||||
* @param {String} jsondata
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const getContent = (tab, jsondata) => {
|
||||
const request = {
|
||||
methodname: 'core_dynamic_tabs_get_content',
|
||||
|
@ -123,7 +123,8 @@ function($, log, autoScroll, str, ModalFactory, ModalEvents, Notification) {
|
||||
* Allow to create non-passive touchstart listeners and prevent page scrolling when dragging
|
||||
* From: https://stackoverflow.com/a/48098097
|
||||
*
|
||||
* @type {Object}
|
||||
* @param {string} eventname
|
||||
* @returns {object}
|
||||
*/
|
||||
var registerNotPassiveListeners = function(eventname) {
|
||||
return {
|
||||
@ -149,13 +150,13 @@ function($, log, autoScroll, str, ModalFactory, ModalEvents, Notification) {
|
||||
*
|
||||
* @param {(String|jQuery|Element)} root JQuery/DOM element representing sortable list (i.e. <ul>, <tbody>) or CSS selector
|
||||
* @param {Object} config Parameters for the list. See defaultParameters above for examples.
|
||||
* @property {(String|jQuery|Element)} config.targetListSelector target lists, by default same as root
|
||||
* @property {String} config.moveHandlerSelector CSS selector for a drag handle. By default '[data-drag-type=move]'
|
||||
* @property {String} config.targetListSelector CSS selector for target lists. By default the same as root
|
||||
* @property {(Boolean|Function)} config.isHorizontal Set to true if the list is horizontal
|
||||
* (can also be a callback with list as an argument)
|
||||
* @property {Boolean} config.autoScroll Engages autoscroll module for automatic vertical scrolling of the
|
||||
* whole page, by default true
|
||||
* @param {(String|jQuery|Element)} config.targetListSelector target lists, by default same as root
|
||||
* @param {String} config.moveHandlerSelector CSS selector for a drag handle. By default '[data-drag-type=move]'
|
||||
* @param {String} config.listSelector CSS selector for target lists. By default the same as root
|
||||
* @param {(Boolean|Function)} config.isHorizontal Set to true if the list is horizontal (can also be a callback
|
||||
* with list as an argument)
|
||||
* @param {Boolean} config.autoScroll Engages autoscroll module for automatic vertical scrolling of the whole page,
|
||||
* by default true
|
||||
*/
|
||||
var SortableList = function(root, config) {
|
||||
|
||||
|
@ -22,18 +22,19 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a wrapper function to throttle the execution of the given
|
||||
* function to at most once every specified period.
|
||||
*
|
||||
* If the function is attempted to be executed while it's in cooldown
|
||||
* (during the wait period) then it'll immediately execute again as
|
||||
* soon as the cooldown is over.
|
||||
*
|
||||
* @method
|
||||
* @param {Function} func The function to throttle
|
||||
* @param {Number} wait The number of milliseconds to wait between executions
|
||||
* @return {Function}
|
||||
*/
|
||||
* Create a wrapper function to throttle the execution of the given
|
||||
*
|
||||
* function to at most once every specified period.
|
||||
*
|
||||
* If the function is attempted to be executed while it's in cooldown
|
||||
* (during the wait period) then it'll immediately execute again as
|
||||
* soon as the cooldown is over.
|
||||
*
|
||||
* @method
|
||||
* @param {Function} func The function to throttle
|
||||
* @param {Number} wait The number of milliseconds to wait between executions
|
||||
* @return {Function}
|
||||
*/
|
||||
export const throttle = (func, wait) => {
|
||||
let onCooldown = false;
|
||||
let runAgain = null;
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -16,7 +16,13 @@
|
||||
/**
|
||||
* Display an embedded form, it is only loaded and reloaded inside its container
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* @module core_form/dynamicform
|
||||
* @copyright 2019 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* See also https://docs.moodle.org/dev/Modal_and_AJAX_forms
|
||||
*
|
||||
* @example
|
||||
* import DynamicForm from 'core_form/dynamicform';
|
||||
*
|
||||
* const dynamicForm = new DynamicForm(document.querySelector('#mycontainer', 'pluginname\\form\\formname');
|
||||
@ -27,11 +33,6 @@
|
||||
* });
|
||||
* dynamicForm.load();
|
||||
*
|
||||
* See also https://docs.moodle.org/dev/Modal_and_AJAX_forms
|
||||
*
|
||||
* @module core_form/dynamicform
|
||||
* @copyright 2019 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
import * as FormChangeChecker from 'core_form/changechecker';
|
||||
@ -160,7 +161,8 @@ export default class DynamicForm {
|
||||
/**
|
||||
* Add listener for an event
|
||||
*
|
||||
* Example:
|
||||
* @param {array} args
|
||||
* @example:
|
||||
* const dynamicForm = new DynamicForm(...);
|
||||
* dynamicForm.addEventListener(dynamicForm.events.FORM_SUBMITTED, e => {
|
||||
* e.preventDefault();
|
||||
@ -285,8 +287,9 @@ export default class DynamicForm {
|
||||
/**
|
||||
* Update form contents
|
||||
*
|
||||
* @param {string} html
|
||||
* @param {string} js
|
||||
* @param {object} param
|
||||
* @param {string} param.html
|
||||
* @param {string} param.js
|
||||
* @returns {Promise}
|
||||
*/
|
||||
updateForm({html, js}) {
|
||||
|
@ -87,13 +87,13 @@ export default class ModalForm {
|
||||
* Shows the required form inside a modal dialogue
|
||||
*
|
||||
* @param {Object} config parameters for the form and modal dialogue:
|
||||
* @property {String} config.formClass PHP class name that handles the form (should extend \core_form\modal )
|
||||
* @property {Object} config.modalConfig modal config - title, type, etc.
|
||||
* @paramy {String} config.formClass PHP class name that handles the form (should extend \core_form\modal )
|
||||
* @paramy {Object} config.modalConfig modal config - title, type, etc.
|
||||
* Default: {removeOnClose: true, type: ModalFactory.types.SAVE_CANCEL}
|
||||
* @property {Object} config.args Arguments for the initial form rendering (for example, id of the edited entity)
|
||||
* @property {String} config.saveButtonText the text to display on the Modal "Save" button (optional)
|
||||
* @property {String} config.saveButtonClasses additional CSS classes for the Modal "Save" button
|
||||
* @property {HTMLElement} config.returnFocus element to return focus to after the dialogue is closed
|
||||
* @paramy {Object} config.args Arguments for the initial form rendering (for example, id of the edited entity)
|
||||
* @paramy {String} config.saveButtonText the text to display on the Modal "Save" button (optional)
|
||||
* @paramy {String} config.saveButtonClasses additional CSS classes for the Modal "Save" button
|
||||
* @paramy {HTMLElement} config.returnFocus element to return focus to after the dialogue is closed
|
||||
*/
|
||||
constructor(config) {
|
||||
this.modal = null;
|
||||
@ -207,7 +207,8 @@ export default class ModalForm {
|
||||
/**
|
||||
* Add listener for an event
|
||||
*
|
||||
* Example:
|
||||
* @param {array} args
|
||||
* @example:
|
||||
* const modalForm = new ModalForm(...);
|
||||
* dynamicForm.addEventListener(modalForm.events.FORM_SUBMITTED, e => {
|
||||
* window.console.log(e.detail);
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/message_drawer_helper.js"],"names":["define","PubSub","MessageDrawerEvents","createConversationWithUser","args","publish","CREATE_CONVERSATION_WITH_USER","hide","HIDE","show","SHOW","showConversation","SHOW_CONVERSATION","showSettings","SHOW_SETTINGS"],"mappings":"AAsBAA,OAAM,sCACN,CACI,aADJ,CAEI,oCAFJ,CADM,CAKN,SACIC,CADJ,CAEIC,CAFJ,CAGE,CAyCE,MAAO,CACHC,0BAA0B,CAnCG,QAA7BA,CAAAA,0BAA6B,CAASC,CAAT,CAAe,CAC5CH,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACI,6BAAnC,CAAkEF,CAAlE,CACH,CAgCM,CAEHG,IAAI,CA7BG,QAAPA,CAAAA,IAAO,EAAW,CAClBN,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACM,IAAnC,CACH,CAyBM,CAGHC,IAAI,CAvBG,QAAPA,CAAAA,IAAO,EAAW,CAClBR,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACQ,IAAnC,CACH,CAkBM,CAIHC,gBAAgB,CAfG,QAAnBA,CAAAA,gBAAmB,CAASP,CAAT,CAAe,CAClCH,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACU,iBAAnC,CAAsDR,CAAtD,CACH,CASM,CAKHS,YAAY,CATG,QAAfA,CAAAA,YAAe,EAAW,CAC1BZ,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACY,aAAnC,CACH,CAEM,CAOV,CAxDK,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 <http://www.gnu.org/licenses/>.\n\n/**\n * Provides some helper functions to trigger actions in the message drawer.\n *\n * @module core_message/message_drawer_helper\n * @copyright 2018 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(\n[\n 'core/pubsub',\n 'core_message/message_drawer_events'\n],\nfunction(\n PubSub,\n MessageDrawerEvents\n) {\n\n /**\n * Trigger an event to create a new conversation in the message drawer.\n *\n * @param {Number} userId The user id to start a conversation.\n */\n var createConversationWithUser = function(args) {\n PubSub.publish(MessageDrawerEvents.CREATE_CONVERSATION_WITH_USER, args);\n };\n\n /**\n * Trigger an event to hide the message drawer.\n */\n var hide = function() {\n PubSub.publish(MessageDrawerEvents.HIDE);\n };\n\n /**\n * Trigger an event to show the message drawer.\n */\n var show = function() {\n PubSub.publish(MessageDrawerEvents.SHOW);\n };\n\n /**\n * Trigger an event to show the given conversation.\n *\n * @param {int} conversationId Id for the conversation to show.\n */\n var showConversation = function(args) {\n PubSub.publish(MessageDrawerEvents.SHOW_CONVERSATION, args);\n };\n\n /**\n * Trigger an event to show messaging settings.\n */\n var showSettings = function() {\n PubSub.publish(MessageDrawerEvents.SHOW_SETTINGS);\n };\n\n return {\n createConversationWithUser: createConversationWithUser,\n hide: hide,\n show: show,\n showConversation: showConversation,\n showSettings: showSettings\n };\n});\n"],"file":"message_drawer_helper.min.js"}
|
||||
{"version":3,"sources":["../src/message_drawer_helper.js"],"names":["define","PubSub","MessageDrawerEvents","createConversationWithUser","args","publish","CREATE_CONVERSATION_WITH_USER","hide","HIDE","show","SHOW","showConversation","SHOW_CONVERSATION","showSettings","SHOW_SETTINGS"],"mappings":"AAsBAA,OAAM,sCACN,CACI,aADJ,CAEI,oCAFJ,CADM,CAKN,SACIC,CADJ,CAEIC,CAFJ,CAGE,CA2CE,MAAO,CACHC,0BAA0B,CApCG,QAA7BA,CAAAA,0BAA6B,CAASC,CAAT,CAAe,CAC5CH,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACI,6BAAnC,CAAkEF,CAAlE,CACH,CAiCM,CAEHG,IAAI,CA9BG,QAAPA,CAAAA,IAAO,EAAW,CAClBN,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACM,IAAnC,CACH,CA0BM,CAGHC,IAAI,CAxBG,QAAPA,CAAAA,IAAO,EAAW,CAClBR,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACQ,IAAnC,CACH,CAmBM,CAIHC,gBAAgB,CAfG,QAAnBA,CAAAA,gBAAmB,CAASP,CAAT,CAAe,CAClCH,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACU,iBAAnC,CAAsDR,CAAtD,CACH,CASM,CAKHS,YAAY,CATG,QAAfA,CAAAA,YAAe,EAAW,CAC1BZ,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACY,aAAnC,CACH,CAEM,CAOV,CA1DK,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 <http://www.gnu.org/licenses/>.\n\n/**\n * Provides some helper functions to trigger actions in the message drawer.\n *\n * @module core_message/message_drawer_helper\n * @copyright 2018 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(\n[\n 'core/pubsub',\n 'core_message/message_drawer_events'\n],\nfunction(\n PubSub,\n MessageDrawerEvents\n) {\n\n /**\n * Trigger an event to create a new conversation in the message drawer.\n *\n * @param {object} args\n * @param {Number} args.userId The user id to start a conversation.\n */\n var createConversationWithUser = function(args) {\n PubSub.publish(MessageDrawerEvents.CREATE_CONVERSATION_WITH_USER, args);\n };\n\n /**\n * Trigger an event to hide the message drawer.\n */\n var hide = function() {\n PubSub.publish(MessageDrawerEvents.HIDE);\n };\n\n /**\n * Trigger an event to show the message drawer.\n */\n var show = function() {\n PubSub.publish(MessageDrawerEvents.SHOW);\n };\n\n /**\n * Trigger an event to show the given conversation.\n *\n * @param {object} args\n * @param {int} args.conversationId Id for the conversation to show.\n */\n var showConversation = function(args) {\n PubSub.publish(MessageDrawerEvents.SHOW_CONVERSATION, args);\n };\n\n /**\n * Trigger an event to show messaging settings.\n */\n var showSettings = function() {\n PubSub.publish(MessageDrawerEvents.SHOW_SETTINGS);\n };\n\n return {\n createConversationWithUser: createConversationWithUser,\n hide: hide,\n show: show,\n showConversation: showConversation,\n showSettings: showSettings\n };\n});\n"],"file":"message_drawer_helper.min.js"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -84,7 +84,7 @@ function(
|
||||
* @param {string} selector The route container.
|
||||
*
|
||||
* @return {array} elements Found route container objects.
|
||||
*/
|
||||
*/
|
||||
var getParametersForRoute = function(namespace, root, selector) {
|
||||
|
||||
var header = root.find(SELECTORS.HEADER_CONTAINER).find(selector);
|
||||
|
@ -33,7 +33,8 @@ function(
|
||||
/**
|
||||
* Trigger an event to create a new conversation in the message drawer.
|
||||
*
|
||||
* @param {Number} userId The user id to start a conversation.
|
||||
* @param {object} args
|
||||
* @param {Number} args.userId The user id to start a conversation.
|
||||
*/
|
||||
var createConversationWithUser = function(args) {
|
||||
PubSub.publish(MessageDrawerEvents.CREATE_CONVERSATION_WITH_USER, args);
|
||||
@ -56,7 +57,8 @@ function(
|
||||
/**
|
||||
* Trigger an event to show the given conversation.
|
||||
*
|
||||
* @param {int} conversationId Id for the conversation to show.
|
||||
* @param {object} args
|
||||
* @param {int} args.conversationId Id for the conversation to show.
|
||||
*/
|
||||
var showConversation = function(args) {
|
||||
PubSub.publish(MessageDrawerEvents.SHOW_CONVERSATION, args);
|
||||
|
@ -351,9 +351,9 @@ function(
|
||||
/**
|
||||
* Build a patch for this conversation.
|
||||
*
|
||||
* @param {Object} state, The current state of this conversation.
|
||||
* @param {Object} newState, The new state of this conversation.
|
||||
* @return {Object} Patch with days and messsages for each day.
|
||||
* @param {Object} state The current state of this conversation.
|
||||
* @param {Object} newState The new state of this conversation.
|
||||
* @returns {Object} Patch with days and messsages for each day.
|
||||
*/
|
||||
var buildConversationPatch = function(state, newState) {
|
||||
var diff = diffArrays(state.messages, newState.messages, isMessageEqual);
|
||||
|
@ -1401,7 +1401,7 @@ function(
|
||||
* @param {Object} header The header container element.
|
||||
* @param {Object} body The body container element.
|
||||
* @param {Object} footer The footer container element.
|
||||
* @param {Bool} isFavourite is this conversation a favourite.
|
||||
* @param {Bool} state is this conversation a favourite.
|
||||
*/
|
||||
var renderIsFavourite = function(header, body, footer, state) {
|
||||
var favouriteIcon = header.find(SELECTORS.FAVOURITE_ICON_CONTAINER);
|
||||
|
@ -513,6 +513,7 @@ define(['jquery'], function($) {
|
||||
*
|
||||
* @param {Object} state Current state.
|
||||
* @param {Array} messageIds Messages to delete.
|
||||
* @param {string} errorMessage
|
||||
* @return {Object} New state with array of pending delete message ids.
|
||||
*/
|
||||
var setMessagesSendFailById = function(state, messageIds, errorMessage) {
|
||||
|
@ -40,7 +40,7 @@ function(
|
||||
/**
|
||||
* Toggle the message drawer visibility.
|
||||
*
|
||||
* @param {String} button The button id for the popover.
|
||||
* @param {String} buttonid The button id for the popover.
|
||||
*/
|
||||
var toggleMessageDrawerVisibility = function(buttonid) {
|
||||
PubSub.publish(MessageDrawerEvents.TOGGLE_VISIBILITY, buttonid);
|
||||
|
@ -763,6 +763,7 @@ define(
|
||||
* @param {int} limit Limit for results
|
||||
* @param {int} offset Offset for results
|
||||
* @param {bool|null} favourites If favourites should be included or not
|
||||
* @param {bool} mergeself
|
||||
* @return {object} jQuery promise
|
||||
*/
|
||||
var getConversations = function(
|
||||
|
@ -92,12 +92,12 @@ define(['jquery',
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the disable all notifications user property in the DOM and
|
||||
* send a request to update on the server.
|
||||
*
|
||||
* @method toggleDisableAllStatus
|
||||
* @return {Promise}
|
||||
*/
|
||||
* Update the disable all notifications user property in the DOM and
|
||||
* send a request to update on the server.
|
||||
*
|
||||
* @method toggleDisableAllStatus
|
||||
* @return {Promise}
|
||||
*/
|
||||
PreferencesController.prototype.toggleDisableAllStatus = function() {
|
||||
var checkbox = $(SELECTORS.DISABLE_NOTIFICATIONS);
|
||||
var container = $(SELECTORS.DISABLE_NOTIFICATIONS_CONTAINER);
|
||||
@ -132,10 +132,10 @@ define(['jquery',
|
||||
};
|
||||
|
||||
/**
|
||||
* Set up all of the event listeners for the PreferencesController.
|
||||
*
|
||||
* @method registerEventListeners
|
||||
*/
|
||||
* Set up all of the event listeners for the PreferencesController.
|
||||
*
|
||||
* @method registerEventListeners
|
||||
*/
|
||||
PreferencesController.prototype.registerEventListeners = function() {
|
||||
var disabledNotificationsElement = $(SELECTORS.DISABLE_NOTIFICATIONS);
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -222,7 +222,6 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
|
||||
*
|
||||
* @private
|
||||
* @method _filterChanged
|
||||
* @param {Event} event
|
||||
*/
|
||||
GradingNavigation.prototype._filterChanged = function() {
|
||||
// There are 3 types of filter right now.
|
||||
@ -536,7 +535,6 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
|
||||
*
|
||||
* @private
|
||||
* @method _handleChangeUser
|
||||
* @param {Event} event
|
||||
*/
|
||||
GradingNavigation.prototype._handleChangeUser = function() {
|
||||
var select = this._region.find('[data-action=change-user]');
|
||||
|
@ -27,7 +27,6 @@ define(['jquery', 'mod_assign/grading_events'], function($, GradingEvents) {
|
||||
* GradingReviewPanel class.
|
||||
*
|
||||
* @class mod_assign/grading_review_panel
|
||||
* @param {String} selector The selector for the page region containing the user navigation.
|
||||
*/
|
||||
var GradingReviewPanel = function() {
|
||||
this._region = $('[data-region="review-panel-content"]');
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user