Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 26... Línea 26...
26
 
26
 
27
import DndCmItem from 'core_courseformat/local/courseeditor/dndcmitem';
27
import DndCmItem from 'core_courseformat/local/courseeditor/dndcmitem';
28
import Templates from 'core/templates';
28
import Templates from 'core/templates';
29
import Prefetch from 'core/prefetch';
29
import Prefetch from 'core/prefetch';
-
 
30
import Config from 'core/config';
Línea 30... Línea 31...
30
import Config from 'core/config';
31
import Pending from "core/pending";
31
 
32
 
32
// Prefetch the completion icons template.
33
// Prefetch the completion icons template.
Línea 90... Línea 91...
90
        const anchor = url.hash.replace('#', '');
91
        const anchor = url.hash.replace('#', '');
91
        // Check if the current url is the cm url.
92
        // Check if the current url is the cm url.
92
        if (window.location.href == cm.url
93
        if (window.location.href == cm.url
93
            || (window.location.href.includes(course.baseurl) && anchor == cm.anchor)
94
            || (window.location.href.includes(course.baseurl) && anchor == cm.anchor)
94
        ) {
95
        ) {
95
            this.reactive.dispatch('setPageItem', 'cm', this.id);
-
 
96
            this.element.scrollIntoView({block: "center"});
96
            this.element.scrollIntoView({block: "center"});
97
        }
97
        }
98
        // Check if this we are displaying this activity page.
98
        // Check if this we are displaying this activity page.
99
        if (Config.contextid != Config.courseContextId && Config.contextInstanceId == this.id) {
99
        if (Config.contextid != Config.courseContextId && Config.contextInstanceId == this.id) {
100
            this.reactive.dispatch('setPageItem', 'cm', this.id, true);
100
            this.reactive.dispatch('setPageItem', 'cm', this.id, true);
Línea 196... Línea 196...
196
        const element = document.getElementById(cm.anchor);
196
        const element = document.getElementById(cm.anchor);
197
        if (element) {
197
        if (element) {
198
            // Make sure the section is expanded.
198
            // Make sure the section is expanded.
199
            this.reactive.dispatch('sectionContentCollapsed', [cm.sectionid], false);
199
            this.reactive.dispatch('sectionContentCollapsed', [cm.sectionid], false);
200
            // Marc the element as page item once the event is handled.
200
            // Marc the element as page item once the event is handled.
-
 
201
            const pendingAnchor = new Pending(`courseformat/activity:openAnchor`);
201
            setTimeout(() => {
202
            setTimeout(() => {
202
                this.reactive.dispatch('setPageItem', 'cm', cm.id);
203
                this.reactive.dispatch('setPageItem', 'cm', cm.id);
-
 
204
                pendingAnchor.resolve();
203
            }, 50);
205
            }, 50);
204
            return;
206
            return;
205
        }
207
        }
206
        // If the element is not present in the page we need to go to the specific section.
208
        // If the element is not present in the page we need to go to the specific section.
207
        const course = this.reactive.get('course');
209
        const course = this.reactive.get('course');