Línea 24... |
Línea 24... |
24 |
import * as CustomEvents from 'core/custom_interaction_events';
|
24 |
import * as CustomEvents from 'core/custom_interaction_events';
|
25 |
import * as View from 'block_timeline/view';
|
25 |
import * as View from 'block_timeline/view';
|
26 |
import * as Notification from 'core/notification';
|
26 |
import * as Notification from 'core/notification';
|
27 |
import * as Utils from 'core/utils';
|
27 |
import * as Utils from 'core/utils';
|
28 |
import * as UserRepository from 'core_user/repository';
|
28 |
import * as UserRepository from 'core_user/repository';
|
- |
|
29 |
import {getFirst} from 'core/normalise';
|
Línea 29... |
Línea 30... |
29 |
|
30 |
|
30 |
const SELECTORS = {
|
31 |
const SELECTORS = {
|
31 |
TIMELINE_DAY_FILTER: '[data-region="day-filter"]',
|
32 |
TIMELINE_DAY_FILTER: '[data-region="day-filter"]',
|
32 |
TIMELINE_DAY_FILTER_OPTION: '[data-from]',
|
33 |
TIMELINE_DAY_FILTER_OPTION: '[data-from]',
|
Línea 105... |
Línea 106... |
105 |
const registerViewSelector = function(root, timelineViewRoot) {
|
106 |
const registerViewSelector = function(root, timelineViewRoot) {
|
106 |
const viewSelector = root.find(SELECTORS.TIMELINE_VIEW_SELECTOR);
|
107 |
const viewSelector = root.find(SELECTORS.TIMELINE_VIEW_SELECTOR);
|
Línea 107... |
Línea 108... |
107 |
|
108 |
|
108 |
// Listen for when the user changes tab so that we can show the first set of courses
|
109 |
// Listen for when the user changes tab so that we can show the first set of courses
|
- |
|
110 |
// and load their events when they request the sort by courses view for the first time.
|
109 |
// and load their events when they request the sort by courses view for the first time.
|
111 |
getFirst(viewSelector).querySelectorAll('[data-bs-toggle="tab"]').forEach((tab) => {
|
110 |
viewSelector.on('shown shown.bs.tab', function(e) {
|
112 |
tab.addEventListener('shown.bs.tab', (e) => {
|
111 |
View.shown(timelineViewRoot);
|
113 |
View.shown(timelineViewRoot);
|
- |
|
114 |
$(e.target).removeClass('active');
|
112 |
$(e.target).removeClass('active');
|
115 |
});
|
Línea 113... |
Línea 116... |
113 |
});
|
116 |
});
|
114 |
|
117 |
|
115 |
|
118 |
|
116 |
// Event selector for user_sort
|
119 |
// Event selector for user_sort
|
117 |
CustomEvents.define(viewSelector, [CustomEvents.events.activate]);
|
120 |
CustomEvents.define(viewSelector, [CustomEvents.events.activate]);
|
118 |
viewSelector.on(CustomEvents.events.activate, "[data-toggle='tab']", function(e) {
|
121 |
viewSelector.on(CustomEvents.events.activate, "[data-bs-toggle='tab']", function(e) {
|
119 |
var filtername = $(e.currentTarget).data('filtername');
|
122 |
var filtername = $(e.currentTarget).data('filtername');
|
120 |
var type = 'block_timeline_user_sort_preference';
|
123 |
var type = 'block_timeline_user_sort_preference';
|