Skip to content
Permalink
Browse files
Merge branch 'MDL-60516-master' of git://github.com/andrewnicols/moodle
  • Loading branch information
David Monllao committed Oct 25, 2017
2 parents 4f7a803 + 80e4426 commit 78511321770b6e5eaed8e36f75fa9adf8121c454

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -70,7 +70,6 @@ define([
LOADING_ICON: '.loading-icon',
VIEW_DAY_LINK: "[data-action='view-day-link']",
CALENDAR_MONTH_WRAPPER: ".calendarwrapper",
COURSE_SELECTOR: 'select[name="course"]',
TODAY: '.today',
};

@@ -268,13 +267,13 @@ define([
renderEventSummaryModal(eventId);
});

root.on('change', SELECTORS.COURSE_SELECTOR, function() {
root.on('change', CalendarSelectors.elements.courseSelector, function() {
var selectElement = $(this);
var courseId = selectElement.val();
CalendarViewManager.reloadCurrentMonth(root, courseId, null)
.then(function() {
// We need to get the selector again because the content has changed.
return root.find(SELECTORS.COURSE_SELECTOR).val(courseId);
return root.find(CalendarSelectors.elements.courseSelector).val(courseId);
})
.fail(Notification.exception);
});
@@ -69,10 +69,10 @@ function(
} else {
// The root has been removed.
// Remove all events in the namespace.
body.on(CalendarEvents.created + namespace);
body.on(CalendarEvents.deleted + namespace);
body.on(CalendarEvents.updated + namespace);
body.on(CalendarEvents.eventMoved + namespace);
body.off(CalendarEvents.created + namespace);
body.off(CalendarEvents.deleted + namespace);
body.off(CalendarEvents.updated + namespace);
body.off(CalendarEvents.eventMoved + namespace);
}
};

@@ -82,6 +82,20 @@ function(

daysWithEvent.toggleClass('calendar_event_' + data.type, !data.hidden);
});

var namespace = '.' + root.attr('id');
$('body').on('change' + namespace, CalendarSelectors.elements.courseSelector, function() {
if (root.is(':visible')) {
var selectElement = $(this);
var courseId = selectElement.val();
var categoryId = null;

CalendarViewManager.reloadCurrentMonth(root, courseId, categoryId);
} else {
$('body').off('change' + namespace);
}
});

};

return {
@@ -47,6 +47,9 @@ define([], function() {
edit: '[data-action="edit"]',
remove: '[data-action="delete"]',
},
elements: {
courseSelector: 'select[name="course"]',
},
today: '.today',
day: '[data-region="day"]',
wrapper: '.calendarwrapper',

0 comments on commit 7851132

Please sign in to comment.