From 5873e1d234bdd10fac5f23872fbc2cd5f3447df0 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Mon, 9 Oct 2017 11:46:50 +0800 Subject: [PATCH] MDL-60374 calendar: Add transition on event show/hide in monthly view --- calendar/templates/month_detailed.mustache | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/calendar/templates/month_detailed.mustache b/calendar/templates/month_detailed.mustache index 942e459120a..2a0b06b4795 100644 --- a/calendar/templates/month_detailed.mustache +++ b/calendar/templates/month_detailed.mustache @@ -140,10 +140,26 @@ require([ M.util.js_pending("month-detailed-{{uniqid}}-filterChanged"); // A filter value has been changed. // Find all matching cells in the popover data, and hide them. - $("#month-detailed-{{uniqid}}") - .find(CalendarSelectors.eventType[data.type]) - .toggleClass('hidden', !!data.hidden); - M.util.js_complete("month-detailed-{{uniqid}}-filterChanged"); + var target = $("#month-detailed-{{uniqid}}").find(CalendarSelectors.eventType[data.type]); + + var transitionPromise = $.Deferred(); + if (data.hidden) { + transitionPromise.then(function() { + return target.slideUp('fast').promise(); + }); + } else { + transitionPromise.then(function() { + return target.slideDown('fast').promise(); + }); + } + + transitionPromise.then(function() { + M.util.js_complete("month-detailed-{{uniqid}}-filterChanged"); + + return; + }); + + transitionPromise.resolve(); }); }); {{/js}}