2 This file is part of Moodle - http://moodle.org/
4 Moodle is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 Moodle is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 @template calendar/month_mini
20 Calendar month view for blocks.
22 The purpose of this template is to render the month view for blocks.
24 Classes required for JS:
27 Data attributes required for JS:
30 Example context (json):
35 }} id="month-mini-{{date.year}}-{{date.mon}}-{{uniqid}}"{{!
36 }} class="calendarwrapper"{{!
37 }} data-courseid="{{courseid}}"{{!
38 }} data-categoryid="{{categoryid}}"{{!
39 }} data-month="{{date.mon}}"{{!
40 }} data-year="{{date.year}}"{{!
41 }} data-day="{{date.mday}}"{{!
42 }} data-view="month"{{!
44 {{> core/overlay_loading}}
45 <table class="minicalendar calendartable">
46 <caption class="calendar-controls">
47 {{#includenavigation}}
50 }} class="arrow_link previous"{{!
51 }} title="{{#str}}monthprev, calendar{{/str}}"{{!
52 }} data-year="{{previousperiod.year}}"{{!
53 }} data-month="{{previousperiod.mon}}"{{!
55 <span class="arrow">{{{larrow}}}</span>
57 <span class="hide"> | </span>
58 <span class="current">
59 <a href="{{{url}}}" title="{{#str}}monththis, calendar{{/str}}">{{periodname}}</a>
61 <span class="hide"> | </span>
64 }} class="arrow_link next"{{!
65 }} title="{{#str}}monthnext, calendar{{/str}}"{{!
66 }} data-year="{{nextperiod.year}}"{{!
67 }} data-month="{{nextperiod.mon}}"{{!
69 <span class="arrow">{{{rarrow}}}</span>
71 {{/includenavigation}}
72 {{^includenavigation}}
74 <a href="{{{url}}}" title="{{#str}}monththis, calendar{{/str}}">{{periodname}}</a>
76 {{/includenavigation}}
81 <th class="header text-xs-center">
82 <span class="sr-only">{{fullname}}</span>
83 <span aria-hidden="true">{{shortname}}</span>
90 <tr data-region="month-view-week">
92 <td class="dayblank"> </td>
95 <td class="day text-center{{!
96 This is the list of additional classes to display.
98 This cell is for today.
99 }}{{#istoday}} today{{/istoday}}{{!
101 This day falls on a weekend.
102 }}{{#isweekend}} weekend{{/isweekend}}{{!
104 There is at least one event.
105 }}{{#events.0}} hasevent{{/events.0}}{{!
107 There are events on this day which span multiple days.
108 }}{{#durationevents.0}} duration{{/durationevents.0}}{{!
109 }}{{#durationevents}} duration_{{.}}{{/durationevents}}{{!
110 }}{{#islastday}} duraction_finish{{/islastday}}{{!
112 These event types fall on this day.
113 }}{{#calendareventtypes}}{{!
114 }} calendar_event_{{.}}{{!
115 }}{{/calendareventtypes}}{{!
117 This day contains the last day of an event.
118 }}{{#haslastdayofevent}}{{!
119 }} duration_finish{{!
120 }}{{/haslastdayofevent}}{{!
123 Add data-eventtype-[eventtype] data attributes.
124 These are used to show and hide events using the filter.
125 }}{{#calendareventtypes}}{{!
126 }} data-eventtype-{{.}}="1"{{!
127 }}{{/calendareventtypes}}{{!
129 This is the timestamp for this month.
130 }} data-day-timestamp="{{timestamp}}"{{!
132 }}<span class="sr-only">{{daytitle}}</span>
134 {{< core_calendar/minicalendar_day_link }}
135 {{$day}}{{mday}}{{/day}}
136 {{$url}}{{viewdaylink}}{{/url}}
137 {{$title}}{{popovertitle}}{{/title}}
138 {{$nocontent}}{{#str}}eventnone, calendar{{/str}}{{/nocontent}}
141 <div data-popover-eventtype-{{normalisedeventtype}}="1">
142 {{> core_calendar/event_icon}}
147 {{/ core_calendar/minicalendar_day_link }}
150 <span aria-hidden="true">{{mday}}</span>
155 <td class="dayblank"> </td>
165 'core_calendar/selectors',
166 'core_calendar/events',
173 $('body').on(CalendarEvents.filterChanged, function(e, data) {
174 M.util.js_pending("month-mini-{{uniqid}}-filterChanged");
175 // A filter value has been changed.
176 // Find all matching cells in the popover data, and hide them.
177 $("#month-mini-{{date.year}}-{{date.mon}}-{{uniqid}}")
178 .find(CalendarSelectors.popoverType[data.type])
179 .toggleClass('hidden', !!data.hidden);
180 M.util.js_complete("month-mini-{{uniqid}}-filterChanged");