mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-59388 core_calendar: fix month view on clean theme
This commit is contained in:
parent
a4af4c9633
commit
836aa3f64a
2
calendar/amd/build/view_manager.min.js
vendored
2
calendar/amd/build/view_manager.min.js
vendored
@ -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),a(b).on("click",f.CALENDAR_NAV_LINK,function(c){var d=a(b).find(f.CALENDAR_MONTH_WRAPPER).data("courseid"),e=a(c.currentTarget);h(e.attr("href"),e.data("time"),d),c.preventDefault()})},h=function(g,h,i){d.getCalendarMonthData(h,i).then(function(a){return window.history.pushState({},"",g),b.render("core_calendar/month_detailed",a)}).then(function(c,d){return a(f.CALENDAR_MONTH_WRAPPER).replaceWith(c),b.runTemplateJS(d)}).done(function(){a("body").trigger(e.monthChanged,[])}).fail(c.exception)};return{init:function(){g(f.ROOT)}}});
|
||||
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);h(e.attr("href"),e.data("time"),d),c.preventDefault()})},h=function(g,h,i){d.getCalendarMonthData(h,i).then(function(a){return window.history.pushState({},"",g),b.render("core_calendar/month_detailed",a)}).then(function(a,c){return b.replaceNodeContents(f.CALENDAR_MONTH_WRAPPER,a,c)}).done(function(){a("body").trigger(e.monthChanged,[h,i])}).fail(c.exception)};return{init:function(){g(f.ROOT)}}});
|
@ -38,7 +38,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core_calendar/reposito
|
||||
var registerEventListeners = function(root) {
|
||||
root = $(root);
|
||||
|
||||
$(root).on('click', SELECTORS.CALENDAR_NAV_LINK, function(e) {
|
||||
root.on('click', SELECTORS.CALENDAR_NAV_LINK, function(e) {
|
||||
var courseId = $(root).find(SELECTORS.CALENDAR_MONTH_WRAPPER).data('courseid');
|
||||
var link = $(e.currentTarget);
|
||||
changeMonth(link.attr('href'), link.data('time'), courseId);
|
||||
@ -58,16 +58,13 @@ define(['jquery', 'core/templates', 'core/notification', 'core_calendar/reposito
|
||||
CalendarRepository.getCalendarMonthData(time, courseid)
|
||||
.then(function(context) {
|
||||
window.history.pushState({}, '', url);
|
||||
|
||||
return Templates.render('core_calendar/month_detailed', context);
|
||||
})
|
||||
.then(function(html, js) {
|
||||
$(SELECTORS.CALENDAR_MONTH_WRAPPER).replaceWith(html);
|
||||
|
||||
return Templates.runTemplateJS(js);
|
||||
return Templates.replaceNodeContents(SELECTORS.CALENDAR_MONTH_WRAPPER, html, js);
|
||||
})
|
||||
.done(function() {
|
||||
$('body').trigger(CalendarEvents.monthChanged, []);
|
||||
$('body').trigger(CalendarEvents.monthChanged, [time, courseid]);
|
||||
})
|
||||
.fail(Notification.exception);
|
||||
};
|
||||
|
2
calendar/classes/external/day_exporter.php
vendored
2
calendar/classes/external/day_exporter.php
vendored
@ -95,7 +95,7 @@ class day_exporter extends exporter {
|
||||
'optional' => true,
|
||||
],
|
||||
'events' => [
|
||||
'type' => event_exporter::read_properties_definition(),
|
||||
'type' => calendar_event_exporter::read_properties_definition(),
|
||||
'multiple' => true,
|
||||
]
|
||||
];
|
||||
|
@ -857,8 +857,6 @@ class core_calendar_external extends external_api {
|
||||
global $CFG, $DB, $USER, $PAGE;
|
||||
require_once($CFG->dirroot."/calendar/lib.php");
|
||||
|
||||
$warnings = [];
|
||||
|
||||
// Parameter validation.
|
||||
$params = self::validate_parameters(self::get_calendar_monthly_view_parameters(), [
|
||||
'time' => $time,
|
||||
|
@ -3424,7 +3424,7 @@ function calendar_get_legacy_events($tstart, $tend, $users, $groups, $courses, $
|
||||
|
||||
|
||||
/**
|
||||
* Get theh calendar view output.
|
||||
* Get the calendar view output.
|
||||
*
|
||||
* @param \calendar_information $calendar The calendar being represented
|
||||
* @param string $view The type of calendar to have displayed
|
||||
@ -3507,23 +3507,9 @@ function calendar_get_view(\calendar_information $calendar, $view) {
|
||||
'cache' => new \core_calendar\external\events_related_objects_cache($events),
|
||||
];
|
||||
|
||||
if ($view === 'upcoming') {
|
||||
$defaultlookahead = CALENDAR_DEFAULT_UPCOMING_LOOKAHEAD;
|
||||
if (isset($CFG->calendar_lookahead)) {
|
||||
$defaultlookahead = intval($CFG->calendar_lookahead);
|
||||
}
|
||||
$lookahead = get_user_preferences('calendar_lookahead', $defaultlookahead);
|
||||
|
||||
$defaultmaxevents = CALENDAR_DEFAULT_UPCOMING_MAXEVENTS;
|
||||
if (isset($CFG->calendar_maxevents)) {
|
||||
$defaultmaxevents = intval($CFG->calendar_maxevents);
|
||||
}
|
||||
$maxevents = get_user_preferences('calendar_maxevents', $defaultmaxevents);
|
||||
} else {
|
||||
$month = new \core_calendar\external\month_exporter($calendar, $type, $related);
|
||||
$data = $month->export($renderer);
|
||||
$template = 'core_calendar/month_detailed';
|
||||
}
|
||||
$month = new \core_calendar\external\month_exporter($calendar, $type, $related);
|
||||
$data = $month->export($renderer);
|
||||
$template = 'core_calendar/month_detailed';
|
||||
|
||||
return [$data, $template];
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
<span class="calendarwrapper" data-courseid="{{courseid}}">
|
||||
{{> core_calendar/month_header }}
|
||||
{{> core_calendar/month_navigation }}
|
||||
<table class="calendarmonth calendartable table card-deck m-b-0">
|
||||
<table class="calendarmonth calendartable card-deck m-b-0">
|
||||
<thead>
|
||||
<tr>
|
||||
{{# daynames }}
|
||||
@ -79,7 +79,7 @@
|
||||
</ul>
|
||||
{{/events.0}}
|
||||
</div>
|
||||
<div class="hidden-md-up">
|
||||
<div class="hidden-md-up hidden-desktop">
|
||||
{{#events.0}}
|
||||
<a href="{{viewdaylink}}" class="day" title="{{viewdaylinktitle}}">{{mday}}</a>
|
||||
{{/events.0}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user