weekly release 3.4dev
[moodle.git] / calendar / templates / month_mini.mustache
CommitLineData
c8b6e9ab
AN
1{{!
2 This file is part of Moodle - http://moodle.org/
3
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.
8
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.
13
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/>.
16}}
17{{!
18 @template calendar/month_mini
19
20 Calendar month view for blocks.
21
22 The purpose of this template is to render the month view for blocks.
23
24 Classes required for JS:
25 * none
26
27 Data attributes required for JS:
28 * none
29
30 Example context (json):
31 {
32 }
33}}
34<div id="month-mini-{{uniqid}}-{{time}}" class="calendarwrapper" data-courseid="{{courseid}}" data-current-time="{{time}}">
35 {{> core/overlay_loading}}
36 <table class="minicalendar calendartable">
37 <caption class="calendar-controls">
38 <a href="#" class="arrow_link previous" title="{{#str}}monthprev, calendar{{/str}}" data-time="{{previousperiod}}"><span class="arrow">{{{larrow}}}</span></a>
39 <span class="hide"> | </span>
40 <span class="current">
41 <a href="{{{url}}}" title="{{#str}}monththis, calendar{{/str}}" data-time="">{{periodname}}</a>
42 </span>
43 <span class="hide"> | </span>
44 <a href="#" class="arrow_link next" title="{{#str}}monthnext, calendar{{/str}}" data-time="{{nextperiod}}"><span class="arrow">{{{rarrow}}}</span></a>
45 </caption>
46 <thead>
47 <tr>
48 {{# daynames }}
49 <th class="header text-xs-center" scope="col">
50 <abbr title="{{fullname}}">{{shortname}}</abbr>
51 </th>
52 {{/ daynames }}
53 </tr>
54 </thead>
55 <tbody>
56{{#weeks}}
57 <tr data-region="month-view-week">
58 {{#prepadding}}
59 <td class="dayblank">&nbsp;</td>
60 {{/prepadding}}
61 {{#days}}
62 <td class="day text-center{{!
63 This is the list of additional classes to display.
64
65 This cell is for today.
66 }}{{#istoday}} today{{/istoday}}{{!
67
68 This day falls on a weekend.
69 }}{{#isweekend}} weekend{{/isweekend}}{{!
70
71 There is at least one event.
72 }}{{#events.0}} hasevent{{/events.0}}{{!
73
74 There are events on this day which span multiple days.
75 }}{{#durationevents.0}} duration{{/durationevents.0}}{{!
76 }}{{#durationevents}} duration_{{.}}{{/durationevents}}{{!
77 }}{{#islastday}} duraction_finish{{/islastday}}{{!
78
79 These event types fall on this day.
80 }}{{#calendareventtypes}}{{!
81 }} calendar_event_{{.}}{{!
82 }}{{/calendareventtypes}}{{!
83
84 This day contains the last day of an event.
85 }}{{#haslastdayofevent}}{{!
86 }} duration_finish{{!
87 }}{{/haslastdayofevent}}{{!
88 }}"{{!
89
90 Add data-eventtype-[eventtype] data attributes.
91 These are used to show and hide events using the filter.
92 }}{{#calendareventtypes}}{{!
93 }} data-eventtype-{{.}}="1"{{!
94 }}{{/calendareventtypes}}{{!
95
96 This is the timestamp for this month.
97 }} data-day-timestamp="{{timestamp}}"{{!
98 }}>{{!
99 }}{{#popovertitle}}
100 {{< core_calendar/minicalendar_day_link }}
101 {{$day}}{{mday}}{{/day}}
102 {{$url}}{{viewdaylink}}{{/url}}
103 {{$title}}{{popovertitle}}{{/title}}
104 {{$nocontent}}{{#str}}eventnone, calendar{{/str}}{{/nocontent}}
105 {{$content}}
106 {{#events}}
107 <div data-popover-eventtype-{{calendareventtype}}="1">
108 {{#modulename}}
109 {{#pix}} icon, {{modulename}} {{/pix}}
110 {{/modulename}}
111 {{^modulename}}
112 {{#pix}} i/{{eventtype}}event, core {{/pix}}
113 {{/modulename}}
114 {{{popupname}}}
115 </div>
116 {{/events}}
117 {{/content}}
118 {{/ core_calendar/minicalendar_day_link }}
119 {{/popovertitle}}{{!
120 }}{{^popovertitle}}
121 {{mday}}
122 {{/popovertitle}}{{!
123 }}</td>
124 {{/days}}
125 {{#postpadding}}
126 <td class="dayblank">&nbsp;</td>
127 {{/postpadding}}
128 </tr>
129{{/weeks}}
130 </tbody>
131 </table>
132</div>
133{{#js}}
134require([
135 'jquery',
136 'core_calendar/selectors',
137 'core_calendar/events',
138], function(
139 $,
140 CalendarSelectors,
141 CalendarEvents
142) {
143
144 $('body').on(CalendarEvents.filterChanged, function(e, data) {
145 M.util.js_pending("month-mini-{{uniqid}}-filterChanged");
146 // A filter value has been changed.
147 // Find all matching cells in the popover data, and hide them.
148 $("#month-mini-{{uniqid}}-{{time}}")
149 .find(CalendarSelectors.popoverType[data.type])
150 .toggleClass('hidden', !!data.hidden);
151 M.util.js_complete("month-mini-{{uniqid}}-filterChanged");
152 });
153});
154{{/js}}