MDL-60558 block_calendar_upcoming: Render the template when no events
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 2 Nov 2017 07:43:17 +0000 (15:43 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 2 Nov 2017 07:43:17 +0000 (15:43 +0800)
blocks/calendar_upcoming/block_calendar_upcoming.php
calendar/templates/upcoming_mini.mustache

index 0d6fc79..e0e0267 100644 (file)
@@ -65,11 +65,7 @@ class block_calendar_upcoming extends block_base {
 
         list($data, $template) = calendar_get_view($calendar, 'upcoming_mini');
 
-        if (empty($data->events)) {
-            $this->content->text = '<div class="post">'. get_string('noupcomingevents', 'calendar').'</div>';
-        } else {
-            $this->content->text .= $renderer->render_from_template($template, $data);
-        }
+        $this->content->text .= $renderer->render_from_template($template, $data);
 
         $this->content->footer = '<div class="gotocal">
                 <a href="'.$CFG->wwwroot.'/calendar/view.php?view=upcoming&amp;course='.$courseid.'">'.
index 1be33f7..082d5bc 100644 (file)
@@ -55,6 +55,9 @@
             <hr>
         </div>
     {{/events}}
+    {{^events}}
+        {{#str}}noupcomingevents, calendar{{/str}}
+    {{/events}}
 </div>
 {{#js}}
 require([