MDL-59890 calendar: Exporters support for categories
[moodle.git] / calendar / templates / month_detailed.mustache
CommitLineData
a4af4c96
SL
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_detailed
19
20 Calendar month view.
21
22 The purpose of this template is to render the month view.
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}}
3fb45f57
AN
34<div{{!
35 }} class="calendarwrapper"{{!
36 }} data-courseid="{{courseid}}"{{!
37 }} data-month="{{date.mon}}"{{!
38 }} data-year="{{date.year}}"{{!
39 }}>
ac671b37 40 {{> core_calendar/header }}
3fb45f57 41 {{> core_calendar/add_event_button}}
64ff737a 42 {{> core_calendar/month_navigation }}
b31a1695 43 {{> core/overlay_loading}}
aefb2950 44 <table id="month-detailed-{{uniqid}}" class="calendarmonth calendartable card-deck m-b-0">
64ff737a
AN
45 <thead>
46 <tr>
47 {{# daynames }}
48 <th class="header text-xs-center">
49 {{shortname}}
50 </th>
51 {{/ daynames }}
52 </tr>
53 </thead>
54 <tbody>
55 {{#weeks}}
5ca142dc 56 <tr data-region="month-view-week">
64ff737a
AN
57 {{#prepadding}}
58 <td class="dayblank">&nbsp;</td>
59 {{/prepadding}}
60 {{#days}}
f6e8cc83 61 <td class="clickable day text-sm-center text-md-left{{!
64ff737a
AN
62 }}{{#istoday}} today{{/istoday}}{{!
63 }}{{#isweekend}} weekend{{/isweekend}}{{!
64 }}{{#durationevents.0}} duration{{/durationevents.0}}{{!
65 }}{{#durationevents}} duration_{{.}}{{/durationevents}}{{!
5ca142dc
RW
66 }}"
67 data-day-timestamp="{{timestamp}}"
aefb2950 68 data-drop-zone="month-view-day"
f6e8cc83
RW
69 data-region="day"
70 data-new-event-timestamp="{{neweventtimestamp}}">
64ff737a
AN
71 <div class="hidden-sm-down text-xs-center">
72 {{#events.0}}
f6e8cc83 73 <a data-action="view-day-link" href="{{viewdaylink}}" class="day" title="{{viewdaylinktitle}}">{{mday}}</a>
64ff737a
AN
74 {{/events.0}}
75 {{^events.0}}
76 {{mday}}
77 {{/events.0}}
78 {{#events.0}}
5ca142dc
RW
79 <div data-region="day-content">
80 <ul>
81 {{#events}}
64ff737a
AN
82 {{#underway}}
83 <li class="events-underway">[{{name}}]</li>
84 {{/underway}}
85 {{^underway}}
fc60d319 86 <li class="calendar_event_{{calendareventtype}}"
f6e8cc83 87 data-region="event-item"
fc60d319 88 data-eventtype-{{calendareventtype}}="1"
5ca142dc
RW
89 {{#canedit}}
90 draggable="true"
91 data-drag-type="move"
92 {{/canedit}}>
93
64ff737a
AN
94 <a data-action="view-event" data-event-id="{{id}}" href="{{url}}">{{name}}</a>
95 </li>
96 {{/underway}}
5ca142dc
RW
97 {{/events}}
98 </ul>
99 </div>
64ff737a
AN
100 {{/events.0}}
101 </div>
836aa3f6 102 <div class="hidden-md-up hidden-desktop">
64ff737a
AN
103 {{#events.0}}
104 <a href="{{viewdaylink}}" class="day" title="{{viewdaylinktitle}}">{{mday}}</a>
105 {{/events.0}}
106 {{^events.0}}
5ca142dc
RW
107 <div data-region="day-content">
108 {{mday}}
109 </div>
64ff737a
AN
110 {{/events.0}}
111 </div>
112 </td>
113 {{/days}}
114 {{#postpadding}}
115 <td class="dayblank">&nbsp;</td>
116 {{/postpadding}}
117 </tr>
118 {{/weeks}}
119 </tbody>
120 </table>
f6e8cc83 121</div>
5ca142dc 122{{#js}}
fc60d319
AN
123require([
124 'jquery',
125 'core_calendar/month_view_drag_drop',
126 'core_calendar/selectors',
127 'core_calendar/events',
128], function(
129 $,
130 DragDrop,
131 CalendarSelectors,
132 CalendarEvents
133) {
5ca142dc
RW
134 var root = $('#month-detailed-{{uniqid}}');
135 DragDrop.init(root);
fc60d319
AN
136
137 $('body').on(CalendarEvents.filterChanged, function(e, data) {
138 M.util.js_pending("month-detailed-{{uniqid}}-filterChanged");
139 // A filter value has been changed.
140 // Find all matching cells in the popover data, and hide them.
141 $("#month-detailed-{{uniqid}}")
142 .find(CalendarSelectors.eventType[data.type])
143 .toggleClass('hidden', !!data.hidden);
144 M.util.js_complete("month-detailed-{{uniqid}}-filterChanged");
145 });
5ca142dc
RW
146});
147{{/js}}