Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 23... Línea 23...
23
 */
23
 */
Línea 24... Línea 24...
24
 
24
 
25
import Header from 'core_courseformat/local/content/section/header';
25
import Header from 'core_courseformat/local/content/section/header';
26
import DndSection from 'core_courseformat/local/courseeditor/dndsection';
26
import DndSection from 'core_courseformat/local/courseeditor/dndsection';
-
 
27
import Templates from 'core/templates';
Línea 27... Línea 28...
27
import Templates from 'core/templates';
28
import Pending from "core/pending";
Línea 28... Línea 29...
28
 
29
 
29
export default class extends DndSection {
30
export default class extends DndSection {
Línea 77... Línea 78...
77
                    fullregion: this.element,
78
                    fullregion: this.element,
78
                });
79
                });
79
                this.configDragDrop(headerComponent);
80
                this.configDragDrop(headerComponent);
80
            }
81
            }
81
        }
82
        }
-
 
83
        this._openSectionIfNecessary();
-
 
84
    }
-
 
85
 
-
 
86
    /**
-
 
87
     * Open the section if the anchored activity is inside.
-
 
88
     */
-
 
89
    async _openSectionIfNecessary() {
-
 
90
        const pageCmInfo = this.reactive.getPageAnchorCmInfo();
-
 
91
        if (!pageCmInfo || pageCmInfo.sectionid !== this.id) {
-
 
92
            return;
-
 
93
        }
-
 
94
        await this.reactive.dispatch('sectionContentCollapsed', [this.id], false);
-
 
95
        const pendingOpen = new Pending(`courseformat/section:openSectionIfNecessary`);
-
 
96
        this.element.scrollIntoView({block: "center"});
-
 
97
        setTimeout(() => {
-
 
98
            this.reactive.dispatch('setPageItem', 'cm', pageCmInfo.id);
-
 
99
            pendingOpen.resolve();
-
 
100
        }, 250);
82
    }
101
    }
Línea 83... Línea 102...
83
 
102
 
84
    /**
103
    /**
85
     * Component watchers.
104
     * Component watchers.
Línea 187... Línea 206...
187
        }
206
        }
188
        // Change icon.
207
        // Change icon.
189
        const icon = affectedAction.querySelector(this.selectors.ICON);
208
        const icon = affectedAction.querySelector(this.selectors.ICON);
190
        if (affectedAction.dataset?.swapicon && icon) {
209
        if (affectedAction.dataset?.swapicon && icon) {
191
            const newIcon = affectedAction.dataset.swapicon;
210
            const newIcon = affectedAction.dataset.swapicon;
-
 
211
            affectedAction.dataset.swapicon = affectedAction.dataset.icon;
-
 
212
            affectedAction.dataset.icon = newIcon;
192
            if (newIcon) {
213
            if (newIcon) {
193
                const pixHtml = await Templates.renderPix(newIcon, 'core');
214
                const pixHtml = await Templates.renderPix(newIcon, 'core');
194
                Templates.replaceNode(icon, pixHtml, '');
215
                Templates.replaceNode(icon, pixHtml, '');
195
            }
216
            }
196
        }
217
        }