mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56:38 +02:00
Merge branch 'MDL-71834-master-v02' of git://github.com/ferranrecio/moodle
This commit is contained in:
commit
551371c710
33 changed files with 274 additions and 25 deletions
2
course/amd/build/actions.min.js
vendored
2
course/amd/build/actions.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -102,6 +102,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
|||
if (actionarea) {
|
||||
var spinner = M.util.add_spinner(Y, Y.Node(actionarea));
|
||||
spinner.show();
|
||||
// Lock the activity state element.
|
||||
if (activity.data('id') !== undefined) {
|
||||
courseeditor.dispatch('cmLock', [activity.data('id')], true);
|
||||
}
|
||||
return spinner;
|
||||
}
|
||||
return null;
|
||||
|
@ -119,6 +123,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
|||
if (actionarea) {
|
||||
var spinner = M.util.add_spinner(Y, Y.Node(actionarea));
|
||||
spinner.show();
|
||||
// Lock the section state element.
|
||||
if (sectionelement.data('id') !== undefined) {
|
||||
courseeditor.dispatch('sectionLock', [sectionelement.data('id')], true);
|
||||
}
|
||||
return spinner;
|
||||
}
|
||||
return null;
|
||||
|
@ -149,6 +157,11 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
|||
if (spinner) {
|
||||
spinner.hide();
|
||||
}
|
||||
// Unlock the state element.
|
||||
if (element.data('id') !== undefined) {
|
||||
const mutation = (element.data('for') === 'section') ? 'sectionLock' : 'cmLock';
|
||||
courseeditor.dispatch(mutation, [element.data('id')], false);
|
||||
}
|
||||
}, delay);
|
||||
};
|
||||
|
||||
|
@ -579,7 +592,19 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
|||
return;
|
||||
}
|
||||
|
||||
// Send the element is locked. Reactive events are only triggered when the state
|
||||
// read only mode is restored. We want to notify the interface the element is
|
||||
// locked so we need to do a quick lock operation before performing the rest
|
||||
// of the mutation.
|
||||
statemanager.setReadOnly(false);
|
||||
cm.locked = true;
|
||||
statemanager.setReadOnly(true);
|
||||
|
||||
// Now we do the real mutation.
|
||||
statemanager.setReadOnly(false);
|
||||
|
||||
// This locked will take effect when the read only is restored.
|
||||
cm.locked = false;
|
||||
|
||||
switch (action) {
|
||||
case 'delete':
|
||||
|
@ -617,7 +642,19 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
|||
return;
|
||||
}
|
||||
|
||||
// Send the element is locked. Reactive events are only triggered when the state
|
||||
// read only mode is restored. We want to notify the interface the element is
|
||||
// locked so we need to do a quick lock operation before performing the rest
|
||||
// of the mutation.
|
||||
statemanager.setReadOnly(false);
|
||||
section.locked = true;
|
||||
statemanager.setReadOnly(true);
|
||||
|
||||
// Now we do the real mutation.
|
||||
statemanager.setReadOnly(false);
|
||||
|
||||
// This locked will take effect when the read only is restored.
|
||||
section.locked = false;
|
||||
|
||||
switch (action) {
|
||||
case 'setmarker':
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
define ("core_courseformat/local/content/section",["exports","core_courseformat/local/content/section/header","core_courseformat/local/courseeditor/dndsection"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){e=function(a){return typeof a}}else{e=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return e(a)}function f(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);if(b)d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable});c.push.apply(c,d)}return c}function g(a){for(var b=1,c;b<arguments.length;b++){c=null!=arguments[b]?arguments[b]:{};if(b%2){f(Object(c),!0).forEach(function(b){h(a,b,c[b])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(a,Object.getOwnPropertyDescriptors(c))}else{f(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}}return a}function h(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}function i(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function j(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function k(a,b,c){if(b)j(a.prototype,b);if(c)j(a,c);return a}function l(a,b){if("function"!=typeof b&&null!==b){throw new TypeError("Super expression must either be null or a function")}a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});if(b)m(a,b)}function m(a,b){m=Object.setPrototypeOf||function(a,b){a.__proto__=b;return a};return m(a,b)}function n(a){return function(){var b=r(a),c;if(q()){var d=r(this).constructor;c=Reflect.construct(b,arguments,d)}else{c=b.apply(this,arguments)}return o(this,c)}}function o(a,b){if(b&&("object"===e(b)||"function"==typeof b)){return b}return p(a)}function p(a){if(void 0===a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function q(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(a){return!1}}function r(a){r=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return r(a)}var s=function(a){l(c,a);var d=n(c);function c(){i(this,c);return d.apply(this,arguments)}k(c,[{key:"create",value:function create(){this.name="content_section";this.selectors={SECTION_ITEM:"[data-for='section_title']",CM:"[data-for=\"cmitem\"]"};this.classes={};this.id=this.element.dataset.id}},{key:"stateReady",value:function stateReady(a){this.configState(a);if(this.reactive.isEditing&&this.reactive.supportComponents){var c=this.getElement(this.selectors.SECTION_ITEM);if(c){var d=new b.default(g({},this,{element:c,fullregion:this.element}));this.configDragDrop(d)}}}},{key:"getWatchers",value:function getWatchers(){return[{watch:"section[".concat(this.id,"]:updated"),handler:this._refreshSection}]}},{key:"getLastCm",value:function getLastCm(){var a=this.getElements(this.selectors.CM);if(!a||0===a.length){return null}return a[a.length-1]}},{key:"_refreshSection",value:function _refreshSection(a){var b,c=a.element;this.element.classList.toggle(this.classes.DRAGGING,null!==(b=c.dragging)&&void 0!==b?b:!1)}}]);return c}(c.default);a.default=s;return a.default});
|
||||
define ("core_courseformat/local/content/section",["exports","core_courseformat/local/content/section/header","core_courseformat/local/courseeditor/dndsection"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){e=function(a){return typeof a}}else{e=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return e(a)}function f(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);if(b)d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable});c.push.apply(c,d)}return c}function g(a){for(var b=1,c;b<arguments.length;b++){c=null!=arguments[b]?arguments[b]:{};if(b%2){f(Object(c),!0).forEach(function(b){h(a,b,c[b])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(a,Object.getOwnPropertyDescriptors(c))}else{f(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}}return a}function h(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}function i(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function j(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function k(a,b,c){if(b)j(a.prototype,b);if(c)j(a,c);return a}function l(a,b){if("function"!=typeof b&&null!==b){throw new TypeError("Super expression must either be null or a function")}a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});if(b)m(a,b)}function m(a,b){m=Object.setPrototypeOf||function(a,b){a.__proto__=b;return a};return m(a,b)}function n(a){return function(){var b=r(a),c;if(q()){var d=r(this).constructor;c=Reflect.construct(b,arguments,d)}else{c=b.apply(this,arguments)}return o(this,c)}}function o(a,b){if(b&&("object"===e(b)||"function"==typeof b)){return b}return p(a)}function p(a){if(void 0===a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function q(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(a){return!1}}function r(a){r=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return r(a)}var s=function(a){l(c,a);var d=n(c);function c(){i(this,c);return d.apply(this,arguments)}k(c,[{key:"create",value:function create(){this.name="content_section";this.selectors={SECTION_ITEM:"[data-for='section_title']",CM:"[data-for=\"cmitem\"]"};this.classes={LOCKED:"editinprogress"};this.id=this.element.dataset.id}},{key:"stateReady",value:function stateReady(a){this.configState(a);if(this.reactive.isEditing&&this.reactive.supportComponents){var c=this.getElement(this.selectors.SECTION_ITEM);if(c){var d=new b.default(g({},this,{element:c,fullregion:this.element}));this.configDragDrop(d)}}}},{key:"getWatchers",value:function getWatchers(){return[{watch:"section[".concat(this.id,"]:updated"),handler:this._refreshSection}]}},{key:"getLastCm",value:function getLastCm(){var a=this.getElements(this.selectors.CM);if(!a||0===a.length){return null}return a[a.length-1]}},{key:"_refreshSection",value:function _refreshSection(a){var b,c,d=a.element;this.element.classList.toggle(this.classes.DRAGGING,null!==(b=d.dragging)&&void 0!==b?b:!1);this.element.classList.toggle(this.classes.LOCKED,null!==(c=d.locked)&&void 0!==c?c:!1);this.locked=d.locked}}]);return c}(c.default);a.default=s;return a.default});
|
||||
//# sourceMappingURL=section.min.js.map
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +1,2 @@
|
|||
define ("core_courseformat/local/content/section/cmitem",["exports","core_courseformat/local/courseeditor/dndcmitem"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);function c(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){c=function(a){return typeof a}}else{c=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return c(a)}function d(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function e(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function f(a,b,c){if(b)e(a.prototype,b);if(c)e(a,c);return a}function g(a,b){if("function"!=typeof b&&null!==b){throw new TypeError("Super expression must either be null or a function")}a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});if(b)h(a,b)}function h(a,b){h=Object.setPrototypeOf||function(a,b){a.__proto__=b;return a};return h(a,b)}function i(a){return function(){var b=m(a),c;if(l()){var d=m(this).constructor;c=Reflect.construct(b,arguments,d)}else{c=b.apply(this,arguments)}return j(this,c)}}function j(a,b){if(b&&("object"===c(b)||"function"==typeof b)){return b}return k(a)}function k(a){if(void 0===a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(a){return!1}}function m(a){m=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return m(a)}var n=function(a){g(b,a);var c=i(b);function b(){d(this,b);return c.apply(this,arguments)}f(b,[{key:"create",value:function create(){this.name="content_section_cmitem";this.selectors={DRAGICON:".editing_move"};this.classes={};this.id=this.element.dataset.id}},{key:"stateReady",value:function stateReady(){var a;this.configDragDrop(this.id);null===(a=this.getElement(this.selectors.DRAGICON))||void 0===a?void 0:a.classList.add(this.classes.DRAGICON)}},{key:"getWatchers",value:function getWatchers(){return[{watch:"cm[".concat(this.id,"]:deleted"),handler:this.unregister},{watch:"cm[".concat(this.id,"]:updated"),handler:this._refreshCm}]}},{key:"_refreshCm",value:function _refreshCm(a){var b,c=a.element;this.element.classList.toggle(this.classes.DRAGGING,null!==(b=c.dragging)&&void 0!==b?b:!1)}}]);return b}(b.default);a.default=n;return a.default});
|
||||
define ("core_courseformat/local/content/section/cmitem",["exports","core_courseformat/local/courseeditor/dndcmitem"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);function c(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){c=function(a){return typeof a}}else{c=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return c(a)}function d(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function e(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function f(a,b,c){if(b)e(a.prototype,b);if(c)e(a,c);return a}function g(a,b){if("function"!=typeof b&&null!==b){throw new TypeError("Super expression must either be null or a function")}a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});if(b)h(a,b)}function h(a,b){h=Object.setPrototypeOf||function(a,b){a.__proto__=b;return a};return h(a,b)}function i(a){return function(){var b=m(a),c;if(l()){var d=m(this).constructor;c=Reflect.construct(b,arguments,d)}else{c=b.apply(this,arguments)}return j(this,c)}}function j(a,b){if(b&&("object"===c(b)||"function"==typeof b)){return b}return k(a)}function k(a){if(void 0===a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(a){return!1}}function m(a){m=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return m(a)}var n=function(a){g(b,a);var c=i(b);function b(){d(this,b);return c.apply(this,arguments)}f(b,[{key:"create",value:function create(){this.name="content_section_cmitem";this.selectors={DRAGICON:".editing_move"};this.classes={LOCKED:"editinprogress"};this.id=this.element.dataset.id}},{key:"stateReady",value:function stateReady(){var a;this.configDragDrop(this.id);null===(a=this.getElement(this.selectors.DRAGICON))||void 0===a?void 0:a.classList.add(this.classes.DRAGICON)}},{key:"getWatchers",value:function getWatchers(){return[{watch:"cm[".concat(this.id,"]:deleted"),handler:this.unregister},{watch:"cm[".concat(this.id,"]:updated"),handler:this._refreshCm}]}},{key:"_refreshCm",value:function _refreshCm(a){var b,c,d=a.element;this.element.classList.toggle(this.classes.DRAGGING,null!==(b=d.dragging)&&void 0!==b?b:!1);this.element.classList.toggle(this.classes.LOCKED,null!==(c=d.locked)&&void 0!==c?c:!1);this.locked=d.locked}}]);return b}(b.default);a.default=n;return a.default});
|
||||
//# sourceMappingURL=cmitem.min.js.map
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["../../../../src/local/content/section/cmitem.js"],"names":["name","selectors","DRAGICON","classes","id","element","dataset","configDragDrop","getElement","classList","add","watch","handler","unregister","_refreshCm","toggle","DRAGGING","dragging","DndCmItem"],"mappings":"mNA0BA,uD,gwDAOa,CAEL,KAAKA,IAAL,CAAY,wBAAZ,CAEA,KAAKC,SAAL,CAAiB,CACbC,QAAQ,gBADK,CAAjB,CAIA,KAAKC,OAAL,CAAe,EAAf,CAEA,KAAKC,EAAL,CAAU,KAAKC,OAAL,CAAaC,OAAb,CAAqBF,EAClC,C,+CAKY,OACT,KAAKG,cAAL,CAAoB,KAAKH,EAAzB,EACA,eAAKI,UAAL,CAAgB,KAAKP,SAAL,CAAeC,QAA/B,wBAA0CO,SAA1C,CAAoDC,GAApD,CAAwD,KAAKP,OAAL,CAAaD,QAArE,CACH,C,iDAOa,CACV,MAAO,CACH,CAACS,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,OAAVT,CAAU,GAAVA,OAAU,CAElB,KAAKA,OAAL,CAAaI,SAAb,CAAuBM,MAAvB,CAA8B,KAAKZ,OAAL,CAAaa,QAA3C,WAAqDX,CAAO,CAACY,QAA7D,mBACH,C,cA9CwBC,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 // All classes will be loaded later by DndCmItem.\n this.classes = {};\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 }\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,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"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,2 +1,2 @@
|
|||
define ("core_courseformat/local/courseeditor/mutations",["exports","core/ajax"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);function c(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function d(a){return function(){var b=this,d=arguments;return new Promise(function(e,f){var i=a.apply(b,d);function g(a){c(i,e,f,g,h,"next",a)}function h(a){c(i,e,f,g,h,"throw",a)}g(void 0)})}}function e(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function f(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function g(a,b,c){if(b)f(a.prototype,b);if(c)f(a,c);return a}var h=function(){function a(){e(this,a)}g(a,[{key:"_callEditWebservice",value:function(){var a=d(regeneratorRuntime.mark(function a(c,d,e,f,g){var h,i;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:h={action:c,courseid:d,ids:e};if(f){h.targetsectionid=f}if(g){h.targetcmid=g}a.next=5;return b.default.call([{methodname:"core_courseformat_update_course",args:h}])[0];case 5:i=a.sent;return a.abrupt("return",JSON.parse(i));case 7:case"end":return a.stop();}}},a)}));return function _callEditWebservice(){return a.apply(this,arguments)}}()},{key:"cmMove",value:function(){var a=d(regeneratorRuntime.mark(function a(b,c,d,e){var f,g;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:if(!(!d&&!e)){a.next=2;break}throw new Error("Mutation cmMove requires targetSectionId or targetCmId");case 2:f=b.get("course");a.next=5;return this._callEditWebservice("cm_move",f.id,c,d,e);case 5:g=a.sent;b.processUpdates(g);case 7:case"end":return a.stop();}}},a,this)}));return function cmMove(){return a.apply(this,arguments)}}()},{key:"sectionMove",value:function(){var a=d(regeneratorRuntime.mark(function a(b,c,d){var e,f;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:if(d){a.next=2;break}throw new Error("Mutation sectionMove requires targetSectionId");case 2:e=b.get("course");a.next=5;return this._callEditWebservice("section_move",e.id,c,d);case 5:f=a.sent;b.processUpdates(f);case 7:case"end":return a.stop();}}},a,this)}));return function sectionMove(){return a.apply(this,arguments)}}()},{key:"cmDrag",value:function cmDrag(a,b,c){this._setElementsValue(a,"cm",b,"dragging",c)}},{key:"sectionDrag",value:function sectionDrag(a,b,c){this._setElementsValue(a,"section",b,"dragging",c)}},{key:"_setElementsValue",value:function _setElementsValue(a,b,c,d,e){a.setReadOnly(!1);c.forEach(function(c){var f=a.get(b,c);if(f){f[d]=e}});a.setReadOnly(!0)}},{key:"cmState",value:function(){var a=d(regeneratorRuntime.mark(function a(b,c){var d,e;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:d=b.get("course");a.next=3;return this._callEditWebservice("cm_state",d.id,c);case 3:e=a.sent;b.processUpdates(e);case 5:case"end":return a.stop();}}},a,this)}));return function cmState(){return a.apply(this,arguments)}}()},{key:"sectionState",value:function(){var a=d(regeneratorRuntime.mark(function a(b,c){var d,e;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:d=b.get("course");a.next=3;return this._callEditWebservice("section_state",d.id,c);case 3:e=a.sent;b.processUpdates(e);case 5:case"end":return a.stop();}}},a,this)}));return function sectionState(){return a.apply(this,arguments)}}()},{key:"courseState",value:function(){var a=d(regeneratorRuntime.mark(function a(b){var c,d;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:c=b.get("course");a.next=3;return this._callEditWebservice("course_state",c.id);case 3:d=a.sent;b.processUpdates(d);case 5:case"end":return a.stop();}}},a,this)}));return function courseState(){return a.apply(this,arguments)}}()}]);return a}();a.default=h;return a.default});
|
||||
define ("core_courseformat/local/courseeditor/mutations",["exports","core/ajax"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);function c(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function d(a){return function(){var b=this,d=arguments;return new Promise(function(e,f){var i=a.apply(b,d);function g(a){c(i,e,f,g,h,"next",a)}function h(a){c(i,e,f,g,h,"throw",a)}g(void 0)})}}function e(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function f(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function g(a,b,c){if(b)f(a.prototype,b);if(c)f(a,c);return a}var h=function(){function a(){e(this,a)}g(a,[{key:"_callEditWebservice",value:function(){var a=d(regeneratorRuntime.mark(function a(c,d,e,f,g){var h,i;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:h={action:c,courseid:d,ids:e};if(f){h.targetsectionid=f}if(g){h.targetcmid=g}a.next=5;return b.default.call([{methodname:"core_courseformat_update_course",args:h}])[0];case 5:i=a.sent;return a.abrupt("return",JSON.parse(i));case 7:case"end":return a.stop();}}},a)}));return function _callEditWebservice(){return a.apply(this,arguments)}}()},{key:"init",value:function init(a){a.addUpdateTypes({prepareFields:this._prepareFields})}},{key:"_prepareFields",value:function _prepareFields(a,b,c){c.locked=!1;return c}},{key:"cmMove",value:function(){var a=d(regeneratorRuntime.mark(function a(b,c,d,e){var f,g;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:if(!(!d&&!e)){a.next=2;break}throw new Error("Mutation cmMove requires targetSectionId or targetCmId");case 2:f=b.get("course");this.cmLock(b,c,!0);a.next=6;return this._callEditWebservice("cm_move",f.id,c,d,e);case 6:g=a.sent;b.processUpdates(g);this.cmLock(b,c,!1);case 9:case"end":return a.stop();}}},a,this)}));return function cmMove(){return a.apply(this,arguments)}}()},{key:"sectionMove",value:function(){var a=d(regeneratorRuntime.mark(function a(b,c,d){var e,f;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:if(d){a.next=2;break}throw new Error("Mutation sectionMove requires targetSectionId");case 2:e=b.get("course");this.sectionLock(b,c,!0);a.next=6;return this._callEditWebservice("section_move",e.id,c,d);case 6:f=a.sent;b.processUpdates(f);this.sectionLock(b,c,!1);case 9:case"end":return a.stop();}}},a,this)}));return function sectionMove(){return a.apply(this,arguments)}}()},{key:"cmDrag",value:function cmDrag(a,b,c){this._setElementsValue(a,"cm",b,"dragging",c)}},{key:"sectionDrag",value:function sectionDrag(a,b,c){this._setElementsValue(a,"section",b,"dragging",c)}},{key:"cmLock",value:function cmLock(a,b,c){this._setElementsValue(a,"cm",b,"locked",c)}},{key:"sectionLock",value:function sectionLock(a,b,c){this._setElementsValue(a,"section",b,"locked",c)}},{key:"_setElementsValue",value:function _setElementsValue(a,b,c,d,e){a.setReadOnly(!1);c.forEach(function(c){var f=a.get(b,c);if(f){f[d]=e}});a.setReadOnly(!0)}},{key:"unlockAll",value:function unlockAll(a){var b=a.state;a.setReadOnly(!1);b.section.forEach(function(a){a.locked=!1});b.cm.forEach(function(a){a.locked=!1});a.setReadOnly(!0)}},{key:"cmState",value:function(){var a=d(regeneratorRuntime.mark(function a(b,c){var d,e;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:this.cmLock(b,c,!0);d=b.get("course");a.next=4;return this._callEditWebservice("cm_state",d.id,c);case 4:e=a.sent;b.processUpdates(e);this.cmLock(b,c,!1);case 7:case"end":return a.stop();}}},a,this)}));return function cmState(){return a.apply(this,arguments)}}()},{key:"sectionState",value:function(){var a=d(regeneratorRuntime.mark(function a(b,c){var d,e;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:this.sectionLock(b,c,!0);d=b.get("course");a.next=4;return this._callEditWebservice("section_state",d.id,c);case 4:e=a.sent;b.processUpdates(e);this.sectionLock(b,c,!1);case 7:case"end":return a.stop();}}},a,this)}));return function sectionState(){return a.apply(this,arguments)}}()},{key:"courseState",value:function(){var a=d(regeneratorRuntime.mark(function a(b){var c,d;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:c=b.get("course");a.next=3;return this._callEditWebservice("course_state",c.id);case 3:d=a.sent;b.processUpdates(d);case 5:case"end":return a.stop();}}},a,this)}));return function courseState(){return a.apply(this,arguments)}}()}]);return a}();a.default=h;return a.default});
|
||||
//# sourceMappingURL=mutations.min.js.map
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +1,2 @@
|
|||
define ("core_courseformat/local/courseindex/cm",["exports","core_courseformat/local/courseeditor/dndcmitem"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);function c(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){c=function(a){return typeof a}}else{c=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return c(a)}function d(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function e(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function f(a,b,c){if(b)e(a.prototype,b);if(c)e(a,c);return a}function g(a,b){if("function"!=typeof b&&null!==b){throw new TypeError("Super expression must either be null or a function")}a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});if(b)h(a,b)}function h(a,b){h=Object.setPrototypeOf||function(a,b){a.__proto__=b;return a};return h(a,b)}function i(a){return function(){var b=m(a),c;if(l()){var d=m(this).constructor;c=Reflect.construct(b,arguments,d)}else{c=b.apply(this,arguments)}return j(this,c)}}function j(a,b){if(b&&("object"===c(b)||"function"==typeof b)){return b}return k(a)}function k(a){if(void 0===a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(a){return!1}}function m(a){m=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return m(a)}var n=function(a){g(b,a);var c=i(b);function b(){d(this,b);return c.apply(this,arguments)}f(b,[{key:"create",value:function create(){this.name="courseindex_cm";this.selectors={CM_NAME:"[data-for='cm_name']"};this.classes={CMHIDDEN:"dimmed"};this.id=this.element.dataset.id}},{key:"stateReady",value:function stateReady(){this.configDragDrop(this.id)}},{key:"getWatchers",value:function getWatchers(){return[{watch:"cm[".concat(this.id,"]:deleted"),handler:this.remove},{watch:"cm[".concat(this.id,"]:updated"),handler:this._refreshCm}]}},{key:"_refreshCm",value:function _refreshCm(a){var b,c=a.element;this.element.classList.toggle(this.classes.CMHIDDEN,!c.visible);this.getElement(this.selectors.CM_NAME).innerHTML=c.name;this.element.classList.toggle(this.classes.DRAGGING,null!==(b=c.dragging)&&void 0!==b?b:!1)}}],[{key:"init",value:function init(a,c){return new b({element:document.getElementById(a),selectors:c})}}]);return b}(b.default);a.default=n;return a.default});
|
||||
define ("core_courseformat/local/courseindex/cm",["exports","core_courseformat/local/courseeditor/dndcmitem"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);function c(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){c=function(a){return typeof a}}else{c=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return c(a)}function d(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function e(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function f(a,b,c){if(b)e(a.prototype,b);if(c)e(a,c);return a}function g(a,b){if("function"!=typeof b&&null!==b){throw new TypeError("Super expression must either be null or a function")}a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});if(b)h(a,b)}function h(a,b){h=Object.setPrototypeOf||function(a,b){a.__proto__=b;return a};return h(a,b)}function i(a){return function(){var b=m(a),c;if(l()){var d=m(this).constructor;c=Reflect.construct(b,arguments,d)}else{c=b.apply(this,arguments)}return j(this,c)}}function j(a,b){if(b&&("object"===c(b)||"function"==typeof b)){return b}return k(a)}function k(a){if(void 0===a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(a){return!1}}function m(a){m=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return m(a)}var n=function(a){g(b,a);var c=i(b);function b(){d(this,b);return c.apply(this,arguments)}f(b,[{key:"create",value:function create(){this.name="courseindex_cm";this.selectors={CM_NAME:"[data-for='cm_name']"};this.classes={CMHIDDEN:"dimmed",LOCKED:"editinprogress"};this.id=this.element.dataset.id}},{key:"stateReady",value:function stateReady(){this.configDragDrop(this.id)}},{key:"getWatchers",value:function getWatchers(){return[{watch:"cm[".concat(this.id,"]:deleted"),handler:this.remove},{watch:"cm[".concat(this.id,"]:updated"),handler:this._refreshCm}]}},{key:"_refreshCm",value:function _refreshCm(a){var b,c,d=a.element;this.element.classList.toggle(this.classes.CMHIDDEN,!d.visible);this.getElement(this.selectors.CM_NAME).innerHTML=d.name;this.element.classList.toggle(this.classes.DRAGGING,null!==(b=d.dragging)&&void 0!==b?b:!1);this.element.classList.toggle(this.classes.LOCKED,null!==(c=d.locked)&&void 0!==c?c:!1);this.locked=d.locked}}],[{key:"init",value:function init(a,c){return new b({element:document.getElementById(a),selectors:c})}}]);return b}(b.default);a.default=n;return a.default});
|
||||
//# sourceMappingURL=cm.min.js.map
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["../../../src/local/courseindex/cm.js"],"names":["Component","name","selectors","CM_NAME","classes","CMHIDDEN","id","element","dataset","configDragDrop","watch","handler","remove","_refreshCm","classList","toggle","visible","getElement","innerHTML","DRAGGING","dragging","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,CAAf,CAIA,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,OAAVN,CAAU,GAAVA,OAAU,CAElB,KAAKA,OAAL,CAAaO,SAAb,CAAuBC,MAAvB,CAA8B,KAAKX,OAAL,CAAaC,QAA3C,CAAqD,CAACE,CAAO,CAACS,OAA9D,EACA,KAAKC,UAAL,CAAgB,KAAKf,SAAL,CAAeC,OAA/B,EAAwCe,SAAxC,CAAoDX,CAAO,CAACN,IAA5D,CACA,KAAKM,OAAL,CAAaO,SAAb,CAAuBC,MAAvB,CAA8B,KAAKX,OAAL,CAAae,QAA3C,WAAqDZ,CAAO,CAACa,QAA7D,mBACH,C,oCApCWC,C,CAAQnB,C,CAAW,CAC3B,MAAO,IAAIF,CAAAA,CAAJ,CAAc,CACjBO,OAAO,CAAEe,QAAQ,CAACC,cAAT,CAAwBF,CAAxB,CADQ,CAEjBnB,SAAS,CAATA,CAFiB,CAAd,CAIV,C,cAhCkCsB,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 };\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 }\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,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"}
|
|
@ -1,2 +1,2 @@
|
|||
define ("core_courseformat/local/courseindex/section",["exports","core_courseformat/local/courseindex/sectiontitle","core_courseformat/local/courseeditor/dndsection"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){e=function(a){return typeof a}}else{e=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return e(a)}function f(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);if(b)d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable});c.push.apply(c,d)}return c}function g(a){for(var b=1,c;b<arguments.length;b++){c=null!=arguments[b]?arguments[b]:{};if(b%2){f(Object(c),!0).forEach(function(b){h(a,b,c[b])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(a,Object.getOwnPropertyDescriptors(c))}else{f(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}}return a}function h(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}function i(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function j(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function k(a,b,c){if(b)j(a.prototype,b);if(c)j(a,c);return a}function l(a,b){if("function"!=typeof b&&null!==b){throw new TypeError("Super expression must either be null or a function")}a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});if(b)m(a,b)}function m(a,b){m=Object.setPrototypeOf||function(a,b){a.__proto__=b;return a};return m(a,b)}function n(a){return function(){var b=r(a),c;if(q()){var d=r(this).constructor;c=Reflect.construct(b,arguments,d)}else{c=b.apply(this,arguments)}return o(this,c)}}function o(a,b){if(b&&("object"===e(b)||"function"==typeof b)){return b}return p(a)}function p(a){if(void 0===a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function q(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(a){return!1}}function r(a){r=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return r(a)}var s=function(a){l(c,a);var d=n(c);function c(){i(this,c);return d.apply(this,arguments)}k(c,[{key:"create",value:function create(){this.name="courseindex_section";this.selectors={SECTION_ITEM:"[data-for='section_item']",SECTION_TITLE:"[data-for='section_title']",CM_LAST:"[data-for=\"cm\"]:last-child"};this.classes={SECTIONHIDDEN:"dimmed",SECTIONCURRENT:"current"};this.id=this.element.dataset.id}},{key:"stateReady",value:function stateReady(a){this.configState(a);if(this.reactive.isEditing&&this.reactive.supportComponents){var c=new b.default(g({},this,{element:this.getElement(this.selectors.SECTION_ITEM),fullregion:this.element}));this.configDragDrop(c)}}},{key:"getWatchers",value:function getWatchers(){return[{watch:"section[".concat(this.id,"]:updated"),handler:this._refreshSection}]}},{key:"getLastCm",value:function getLastCm(){return this.getElement(this.selectors.CM_LAST)}},{key:"_refreshSection",value:function _refreshSection(a){var b,c=a.element,d=this.getElement(this.selectors.SECTION_ITEM);d.classList.toggle(this.classes.SECTIONHIDDEN,!c.visible);this.element.classList.toggle(this.classes.SECTIONCURRENT,c.current);this.element.classList.toggle(this.classes.DRAGGING,null!==(b=c.dragging)&&void 0!==b?b:!1);this.getElement(this.selectors.SECTION_TITLE).innerHTML=c.title}}],[{key:"init",value:function init(a,b){return new c({element:document.getElementById(a),selectors:b})}}]);return c}(c.default);a.default=s;return a.default});
|
||||
define ("core_courseformat/local/courseindex/section",["exports","core_courseformat/local/courseindex/sectiontitle","core_courseformat/local/courseeditor/dndsection"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){e=function(a){return typeof a}}else{e=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return e(a)}function f(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);if(b)d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable});c.push.apply(c,d)}return c}function g(a){for(var b=1,c;b<arguments.length;b++){c=null!=arguments[b]?arguments[b]:{};if(b%2){f(Object(c),!0).forEach(function(b){h(a,b,c[b])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(a,Object.getOwnPropertyDescriptors(c))}else{f(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}}return a}function h(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}function i(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function j(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function k(a,b,c){if(b)j(a.prototype,b);if(c)j(a,c);return a}function l(a,b){if("function"!=typeof b&&null!==b){throw new TypeError("Super expression must either be null or a function")}a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});if(b)m(a,b)}function m(a,b){m=Object.setPrototypeOf||function(a,b){a.__proto__=b;return a};return m(a,b)}function n(a){return function(){var b=r(a),c;if(q()){var d=r(this).constructor;c=Reflect.construct(b,arguments,d)}else{c=b.apply(this,arguments)}return o(this,c)}}function o(a,b){if(b&&("object"===e(b)||"function"==typeof b)){return b}return p(a)}function p(a){if(void 0===a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function q(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(a){return!1}}function r(a){r=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return r(a)}var s=function(a){l(c,a);var d=n(c);function c(){i(this,c);return d.apply(this,arguments)}k(c,[{key:"create",value:function create(){this.name="courseindex_section";this.selectors={SECTION_ITEM:"[data-for='section_item']",SECTION_TITLE:"[data-for='section_title']",CM_LAST:"[data-for=\"cm\"]:last-child"};this.classes={SECTIONHIDDEN:"dimmed",SECTIONCURRENT:"current",LOCKED:"editinprogress"};this.id=this.element.dataset.id}},{key:"stateReady",value:function stateReady(a){this.configState(a);if(this.reactive.isEditing&&this.reactive.supportComponents){var c=new b.default(g({},this,{element:this.getElement(this.selectors.SECTION_ITEM),fullregion:this.element}));this.configDragDrop(c)}}},{key:"getWatchers",value:function getWatchers(){return[{watch:"section[".concat(this.id,"]:updated"),handler:this._refreshSection}]}},{key:"getLastCm",value:function getLastCm(){return this.getElement(this.selectors.CM_LAST)}},{key:"_refreshSection",value:function _refreshSection(a){var b,c,d=a.element,e=this.getElement(this.selectors.SECTION_ITEM);e.classList.toggle(this.classes.SECTIONHIDDEN,!d.visible);this.element.classList.toggle(this.classes.SECTIONCURRENT,d.current);this.element.classList.toggle(this.classes.DRAGGING,null!==(b=d.dragging)&&void 0!==b?b:!1);this.element.classList.toggle(this.classes.LOCKED,null!==(c=d.locked)&&void 0!==c?c:!1);this.locked=d.locked;this.getElement(this.selectors.SECTION_TITLE).innerHTML=d.title}}],[{key:"init",value:function init(a,b){return new c({element:document.getElementById(a),selectors:b})}}]);return c}(c.default);a.default=s;return a.default});
|
||||
//# sourceMappingURL=section.min.js.map
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -38,8 +38,10 @@ export default class extends DndSection {
|
|||
SECTION_ITEM: `[data-for='section_title']`,
|
||||
CM: `[data-for="cmitem"]`,
|
||||
};
|
||||
// All classes will be loaded later by DndCmItem.
|
||||
this.classes = {};
|
||||
// Most classes will be loaded later by DndCmItem.
|
||||
this.classes = {
|
||||
LOCKED: 'editinprogress',
|
||||
};
|
||||
|
||||
// We need our id to watch specific events.
|
||||
this.id = this.element.dataset.id;
|
||||
|
@ -101,5 +103,7 @@ export default class extends DndSection {
|
|||
_refreshSection({element}) {
|
||||
// Update classes.
|
||||
this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false);
|
||||
this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);
|
||||
this.locked = element.locked;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,10 @@ export default class extends DndCmItem {
|
|||
this.selectors = {
|
||||
DRAGICON: `.editing_move`,
|
||||
};
|
||||
// All classes will be loaded later by DndCmItem.
|
||||
this.classes = {};
|
||||
// Most classes will be loaded later by DndCmItem.
|
||||
this.classes = {
|
||||
LOCKED: 'editinprogress',
|
||||
};
|
||||
// We need our id to watch specific events.
|
||||
this.id = this.element.dataset.id;
|
||||
}
|
||||
|
@ -72,5 +74,7 @@ export default class extends DndCmItem {
|
|||
_refreshCm({element}) {
|
||||
// Update classes.
|
||||
this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false);
|
||||
this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);
|
||||
this.locked = element.locked;
|
||||
}
|
||||
}
|
|
@ -220,7 +220,10 @@ export default class extends Reactive {
|
|||
try {
|
||||
await super.dispatch(...args);
|
||||
} catch (error) {
|
||||
// Display error modal.
|
||||
notification.exception(error);
|
||||
// Force unlock all elements.
|
||||
super.dispatch('unlockAll');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,37 @@ export default class {
|
|||
return JSON.parse(ajaxresult);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mutation module initialize.
|
||||
*
|
||||
* The reactive instance will execute this method when addMutations or setMutation is invoked.
|
||||
*
|
||||
* @param {StateManager} stateManager the state manager
|
||||
*/
|
||||
init(stateManager) {
|
||||
// Add a method to prepare the fields when some update is comming from the server.
|
||||
stateManager.addUpdateTypes({
|
||||
prepareFields: this._prepareFields,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add default values to state elements.
|
||||
*
|
||||
* This method is called every time a webservice returns a update state message.
|
||||
*
|
||||
* @param {Object} stateManager the state manager
|
||||
* @param {String} updateName the state element to update
|
||||
* @param {Object} fields the new data
|
||||
* @returns {Object} final fields data
|
||||
*/
|
||||
_prepareFields(stateManager, updateName, fields) {
|
||||
// Any update should unlock the element.
|
||||
fields.locked = false;
|
||||
return fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move course modules to specific course location.
|
||||
*
|
||||
|
@ -76,8 +107,10 @@ export default class {
|
|||
throw new Error(`Mutation cmMove requires targetSectionId or targetCmId`);
|
||||
}
|
||||
const course = stateManager.get('course');
|
||||
this.cmLock(stateManager, cmids, true);
|
||||
const updates = await this._callEditWebservice('cm_move', course.id, cmids, targetSectionId, targetCmId);
|
||||
stateManager.processUpdates(updates);
|
||||
this.cmLock(stateManager, cmids, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,8 +125,10 @@ export default class {
|
|||
throw new Error(`Mutation sectionMove requires targetSectionId`);
|
||||
}
|
||||
const course = stateManager.get('course');
|
||||
this.sectionLock(stateManager, sectionIds, true);
|
||||
const updates = await this._callEditWebservice('section_move', course.id, sectionIds, targetSectionId);
|
||||
stateManager.processUpdates(updates);
|
||||
this.sectionLock(stateManager, sectionIds, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,6 +153,28 @@ export default class {
|
|||
this._setElementsValue(stateManager, 'section', sectionIds, 'dragging', dragValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock or unlock course modules.
|
||||
*
|
||||
* @param {StateManager} stateManager the current state manager
|
||||
* @param {array} cmIds the list of course modules ids
|
||||
* @param {bool} lockValue the new locked value
|
||||
*/
|
||||
cmLock(stateManager, cmIds, lockValue) {
|
||||
this._setElementsValue(stateManager, 'cm', cmIds, 'locked', lockValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock or unlock course sections.
|
||||
*
|
||||
* @param {StateManager} stateManager the current state manager
|
||||
* @param {array} sectionIds the list of section ids
|
||||
* @param {bool} lockValue the new locked value
|
||||
*/
|
||||
sectionLock(stateManager, sectionIds, lockValue) {
|
||||
this._setElementsValue(stateManager, 'section', sectionIds, 'locked', lockValue);
|
||||
}
|
||||
|
||||
_setElementsValue(stateManager, name, ids, fieldName, newValue) {
|
||||
stateManager.setReadOnly(false);
|
||||
ids.forEach((id) => {
|
||||
|
@ -129,6 +186,23 @@ export default class {
|
|||
stateManager.setReadOnly(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlock all course elements.
|
||||
*
|
||||
* @param {StateManager} stateManager the current state manager
|
||||
*/
|
||||
unlockAll(stateManager) {
|
||||
const state = stateManager.state;
|
||||
stateManager.setReadOnly(false);
|
||||
state.section.forEach((section) => {
|
||||
section.locked = false;
|
||||
});
|
||||
state.cm.forEach((cm) => {
|
||||
cm.locked = false;
|
||||
});
|
||||
stateManager.setReadOnly(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updated state data related to some cm ids.
|
||||
*
|
||||
|
@ -137,9 +211,11 @@ export default class {
|
|||
* @param {array} cmids the list of cm ids to update
|
||||
*/
|
||||
async cmState(stateManager, cmids) {
|
||||
this.cmLock(stateManager, cmids, true);
|
||||
const course = stateManager.get('course');
|
||||
const updates = await this._callEditWebservice('cm_state', course.id, cmids);
|
||||
stateManager.processUpdates(updates);
|
||||
this.cmLock(stateManager, cmids, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,9 +226,11 @@ export default class {
|
|||
* @param {array} sectionIds the list of section ids to update
|
||||
*/
|
||||
async sectionState(stateManager, sectionIds) {
|
||||
this.sectionLock(stateManager, sectionIds, true);
|
||||
const course = stateManager.get('course');
|
||||
const updates = await this._callEditWebservice('section_state', course.id, sectionIds);
|
||||
stateManager.processUpdates(updates);
|
||||
this.sectionLock(stateManager, sectionIds, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,6 +41,7 @@ export default class Component extends DndCmItem {
|
|||
// Default classes to toggle on refresh.
|
||||
this.classes = {
|
||||
CMHIDDEN: 'dimmed',
|
||||
LOCKED: 'editinprogress',
|
||||
};
|
||||
// We need our id to watch specific events.
|
||||
this.id = this.element.dataset.id;
|
||||
|
@ -89,6 +90,8 @@ export default class Component extends DndCmItem {
|
|||
this.element.classList.toggle(this.classes.CMHIDDEN, !element.visible);
|
||||
this.getElement(this.selectors.CM_NAME).innerHTML = element.name;
|
||||
this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false);
|
||||
this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);
|
||||
this.locked = element.locked;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ export default class Component extends DndSection {
|
|||
this.classes = {
|
||||
SECTIONHIDDEN: 'dimmed',
|
||||
SECTIONCURRENT: 'current',
|
||||
LOCKED: 'editinprogress',
|
||||
};
|
||||
|
||||
// We need our id to watch specific events.
|
||||
|
@ -115,6 +116,8 @@ export default class Component extends DndSection {
|
|||
sectionitem.classList.toggle(this.classes.SECTIONHIDDEN, !element.visible);
|
||||
this.element.classList.toggle(this.classes.SECTIONCURRENT, element.current);
|
||||
this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false);
|
||||
this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);
|
||||
this.locked = element.locked;
|
||||
// Update title.
|
||||
this.getElement(this.selectors.SECTION_TITLE).innerHTML = element.title;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue