MDL-59677 core_calendar: add missing return on changeMonth promises

This commit is contained in:
Simey Lameze 2017-08-21 15:46:41 +08:00
parent 516e74440a
commit 47b55dade4
2 changed files with 3 additions and 1 deletions

View File

@ -1 +1 @@
define(["jquery","core/templates","core/notification","core_calendar/repository","core_calendar/events"],function(a,b,c,d,e){var f={ROOT:"[data-region='calendar']",CALENDAR_NAV_LINK:"span.calendarwrapper .arrow_link",CALENDAR_MONTH_WRAPPER:".calendarwrapper"},g=function(b){b=a(b),b.on("click",f.CALENDAR_NAV_LINK,function(c){var d=a(b).find(f.CALENDAR_MONTH_WRAPPER).data("courseid"),e=a(c.currentTarget);i(e.attr("href"),e.data("time"),d),c.preventDefault()})},h=function(a,e){return d.getCalendarMonthData(a,e).then(function(a){return b.render("core_calendar/month_detailed",a)}).then(function(a,c){return b.replaceNodeContents(f.CALENDAR_MONTH_WRAPPER,a,c)}).fail(c.exception)},i=function(b,c,d){return h(c,d).then(function(){window.history.pushState({},"",b)}).then(function(){a("body").trigger(e.monthChanged,[c,d])})},j=function(){var b=a(f.ROOT),c=b.find(f.CALENDAR_MONTH_WRAPPER).data("courseid"),d=b.find(f.CALENDAR_MONTH_WRAPPER).data("current-time");return h(d,c)};return{init:function(){g(f.ROOT)},reloadCurrentMonth:j,changeMonth:i,refreshMonthContent:h}}); define(["jquery","core/templates","core/notification","core_calendar/repository","core_calendar/events"],function(a,b,c,d,e){var f={ROOT:"[data-region='calendar']",CALENDAR_NAV_LINK:"span.calendarwrapper .arrow_link",CALENDAR_MONTH_WRAPPER:".calendarwrapper"},g=function(b){b=a(b),b.on("click",f.CALENDAR_NAV_LINK,function(c){var d=a(b).find(f.CALENDAR_MONTH_WRAPPER).data("courseid"),e=a(c.currentTarget);i(e.attr("href"),e.data("time"),d),c.preventDefault()})},h=function(a,e){return d.getCalendarMonthData(a,e).then(function(a){return b.render("core_calendar/month_detailed",a)}).then(function(a,c){return b.replaceNodeContents(f.CALENDAR_MONTH_WRAPPER,a,c)}).fail(c.exception)},i=function(b,c,d){return h(c,d).then(function(){return window.history.pushState({},"",b),arguments}).then(function(){return a("body").trigger(e.monthChanged,[c,d]),arguments})},j=function(){var b=a(f.ROOT),c=b.find(f.CALENDAR_MONTH_WRAPPER).data("courseid"),d=b.find(f.CALENDAR_MONTH_WRAPPER).data("current-time");return h(d,c)};return{init:function(){g(f.ROOT)},reloadCurrentMonth:j,changeMonth:i,refreshMonthContent:h}});

View File

@ -77,9 +77,11 @@ define(['jquery', 'core/templates', 'core/notification', 'core_calendar/reposito
return refreshMonthContent(time, courseid) return refreshMonthContent(time, courseid)
.then(function() { .then(function() {
window.history.pushState({}, '', url); window.history.pushState({}, '', url);
return arguments;
}) })
.then(function() { .then(function() {
$('body').trigger(CalendarEvents.monthChanged, [time, courseid]); $('body').trigger(CalendarEvents.monthChanged, [time, courseid]);
return arguments;
}); });
}; };