MDL-65671 calendar: tidy up calendar header

This commit is contained in:
Simey Lameze 2019-06-06 14:08:43 +08:00
parent 859bc931d8
commit fed1cc738d
9 changed files with 25 additions and 9 deletions

View file

@ -297,7 +297,8 @@ class core_calendar_renderer extends plugin_renderer_base {
} }
$select = html_writer::label($label, 'course', false, ['class' => 'mr-1']); $select = html_writer::label($label, 'course', false, ['class' => 'mr-1']);
$select .= html_writer::select($courseoptions, 'course', $selected, false, ['class' => 'cal_courses_flt']); $select .= html_writer::select($courseoptions, 'course', $selected, false,
['class' => 'cal_courses_flt mr-auto']);
return $select; return $select;
} }

View file

@ -31,7 +31,7 @@
{ {
} }
}} }}
<div class="header d-flex flex-wrap mb-5"> <div class="header d-flex flex-wrap">
{{> core_calendar/view_selector}} {{> core_calendar/view_selector}}
{{#filter_selector}} {{#filter_selector}}
{{{filter_selector}}} {{{filter_selector}}}

View file

@ -33,6 +33,6 @@
}} }}
<div class="calendarwrapper" data-view="upcoming" data-context-id="{{defaulteventcontext}}" data-courseid="{{courseid}}"> <div class="calendarwrapper" data-view="upcoming" data-context-id="{{defaulteventcontext}}" data-courseid="{{courseid}}">
{{> core/overlay_loading}} {{> core/overlay_loading}}
<h2 class="current">{{#str}}upcomingevents, core_calendar{{/str}}</h2> <h2 class="current text-center">{{#str}}upcomingevents, core_calendar{{/str}}</h2>
{{> core_calendar/event_list }} {{> core_calendar/event_list }}
</div> </div>

View file

@ -26,9 +26,8 @@
"viewingupcoming": false "viewingupcoming": false
} }
}} }}
<div class="dropdown mb-1" data-region="view-selector"> <div data-region="view-selector">
<button id="calendarviewdropdown" type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button id="calendarviewdropdown" type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{#pix}} a/view_icon_active {{/pix}}
<span class="d-sm-inline-block" data-active-item-text> <span class="d-sm-inline-block" data-active-item-text>
{{#viewingmonth}}{{#str}} month {{/str}}{{/viewingmonth}} {{#viewingmonth}}{{#str}} month {{/str}}{{/viewingmonth}}
{{#viewingday}}{{#str}} day, core_calendar {{/str}}{{/viewingday}} {{#viewingday}}{{#str}} day, core_calendar {{/str}}{{/viewingday}}

View file

@ -61,7 +61,9 @@ if (empty($time)) {
$time = time(); $time = time();
} }
if ($courseid != SITEID) { $iscoursecalendar = $courseid != SITEID;
if ($iscoursecalendar) {
$url->param('course', $courseid); $url->param('course', $courseid);
} }
@ -80,7 +82,7 @@ $PAGE->set_url($url);
$course = get_course($courseid); $course = get_course($courseid);
if ($courseid != SITEID && !empty($courseid)) { if ($iscoursecalendar && !empty($courseid)) {
navigation_node::override_active_url(new moodle_url('/course/view.php', array('id' => $course->id))); navigation_node::override_active_url(new moodle_url('/course/view.php', array('id' => $course->id)));
} else if (!empty($categoryid)) { } else if (!empty($categoryid)) {
core_course_category::get($categoryid); // Check that category exists and can be accessed. core_course_category::get($categoryid); // Check that category exists and can be accessed.
@ -115,7 +117,10 @@ switch($view) {
// Print title and header // Print title and header
$PAGE->set_pagelayout('standard'); $PAGE->set_pagelayout('standard');
$PAGE->set_title("$course->shortname: $strcalendar: $pagetitle"); $PAGE->set_title("$course->shortname: $strcalendar: $pagetitle");
$PAGE->set_heading($COURSE->fullname);
$headingstr = ($iscoursecalendar) ? get_string('coursecalendar', 'core_calendar', $COURSE->shortname) :
get_string('calendar', 'core_calendar');
$PAGE->set_heading($headingstr);
$renderer = $PAGE->get_renderer('core_calendar'); $renderer = $PAGE->get_renderer('core_calendar');
$calendar->add_sidecalendar_blocks($renderer, true, $view); $calendar->add_sidecalendar_blocks($renderer, true, $view);
@ -123,7 +128,7 @@ $calendar->add_sidecalendar_blocks($renderer, true, $view);
echo $OUTPUT->header(); echo $OUTPUT->header();
echo $renderer->start_layout(); echo $renderer->start_layout();
echo html_writer::start_tag('div', array('class'=>'heightcontainer')); echo html_writer::start_tag('div', array('class'=>'heightcontainer'));
echo $OUTPUT->heading(get_string('calendar', 'calendar'));
list($data, $template) = calendar_get_view($calendar, $view, true, false, $lookahead); list($data, $template) = calendar_get_view($calendar, $view, true, false, $lookahead);

View file

@ -46,6 +46,7 @@ $string['course'] = 'Course';
$string['courseevent'] = 'Course event'; $string['courseevent'] = 'Course event';
$string['courseevents'] = 'Course events'; $string['courseevents'] = 'Course events';
$string['categoryevents'] = 'Category events'; $string['categoryevents'] = 'Category events';
$string['coursecalendar'] = '{$a} calendar';
$string['courses'] = 'Courses'; $string['courses'] = 'Courses';
$string['customexport'] = 'Custom range ({$a->timestart} - {$a->timeend})'; $string['customexport'] = 'Custom range ({$a->timestart} - {$a->timeend})';
$string['daily'] = 'Daily'; $string['daily'] = 'Daily';

View file

@ -437,3 +437,7 @@ table.calendartable caption {
margin: 0; margin: 0;
} }
} }
.cal_courses_flt {
color: #868e96;
}

View file

@ -11677,6 +11677,9 @@ table.calendartable caption {
.description-content > p { .description-content > p {
margin: 0; } margin: 0; }
.cal_courses_flt {
color: #868e96; }
/* course.less */ /* course.less */
/* COURSE CONTENT */ /* COURSE CONTENT */
.section-modchooser-link img { .section-modchooser-link img {

View file

@ -11919,6 +11919,9 @@ table.calendartable caption {
.description-content > p { .description-content > p {
margin: 0; } margin: 0; }
.cal_courses_flt {
color: #868e96; }
/* course.less */ /* course.less */
/* COURSE CONTENT */ /* COURSE CONTENT */
.section-modchooser-link img { .section-modchooser-link img {