MDL-63999 calendar: double escape event name on templates
[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"{{!
d0e56d84
AN
36 }}{{#courseid}} data-courseid="{{courseid}}"{{/courseid}}{{!
37 }}{{#categoryid}} data-categoryid="{{categoryid}}"{{/categoryid}}{{!
e00aed51 38 }} data-context-id="{{defaulteventcontext}}"{{!
3fb45f57
AN
39 }} data-month="{{date.mon}}"{{!
40 }} data-year="{{date.year}}"{{!
3ea4f446 41 }} data-view="month"{{!
3fb45f57 42 }}>
ac671b37 43 {{> core_calendar/header }}
64ff737a 44 {{> core_calendar/month_navigation }}
b31a1695 45 {{> core/overlay_loading}}
3ec69c2e 46 <table id="month-detailed-{{uniqid}}" class="calendarmonth calendartable m-b-0">
64ff737a
AN
47 <thead>
48 <tr>
49 {{# daynames }}
50 <th class="header text-xs-center">
51 {{shortname}}
52 </th>
53 {{/ daynames }}
54 </tr>
55 </thead>
56 <tbody>
57 {{#weeks}}
5ca142dc 58 <tr data-region="month-view-week">
64ff737a
AN
59 {{#prepadding}}
60 <td class="dayblank">&nbsp;</td>
61 {{/prepadding}}
62 {{#days}}
39cda405 63 <td class="day text-sm-center text-md-left{{!
64ff737a
AN
64 }}{{#istoday}} today{{/istoday}}{{!
65 }}{{#isweekend}} weekend{{/isweekend}}{{!
66 }}{{#durationevents.0}} duration{{/durationevents.0}}{{!
67 }}{{#durationevents}} duration_{{.}}{{/durationevents}}{{!
39cda405 68 }}{{#defaulteventcontext}} clickable{{/defaulteventcontext}}{{!
5ca142dc
RW
69 }}"
70 data-day-timestamp="{{timestamp}}"
aefb2950 71 data-drop-zone="month-view-day"
f6e8cc83
RW
72 data-region="day"
73 data-new-event-timestamp="{{neweventtimestamp}}">
3ec69c2e 74 <div class="d-none d-md-block hidden-phone text-xs-center">
a4f94944 75 {{#hasevents}}
f6e8cc83 76 <a data-action="view-day-link" href="{{viewdaylink}}" class="day" title="{{viewdaylinktitle}}">{{mday}}</a>
a4f94944
RW
77 {{/hasevents}}
78 {{^hasevents}}
64ff737a 79 {{mday}}
a4f94944
RW
80 {{/hasevents}}
81 {{#hasevents}}
5ca142dc
RW
82 <div data-region="day-content">
83 <ul>
84 {{#events}}
64ff737a 85 {{#underway}}
b8c05345 86 <li class="events-underway">[{{{name}}}]</li>
64ff737a
AN
87 {{/underway}}
88 {{^underway}}
a7ed05e7 89 <li data-region="event-item"
fc60d319 90 data-eventtype-{{calendareventtype}}="1"
6688ae2b 91 {{#draggable}}
5ca142dc
RW
92 draggable="true"
93 data-drag-type="move"
c56dd950
RW
94 {{#mindaytimestamp}}
95 data-min-day-timestamp="{{.}}"
96 {{/mindaytimestamp}}
97 {{#mindayerror}}
98 data-min-day-error="{{.}}"
99 {{/mindayerror}}
100 {{#maxdaytimestamp}}
101 data-max-day-timestamp="{{.}}"
102 {{/maxdaytimestamp}}
103 {{#maxdayerror}}
104 data-max-day-error="{{.}}"
105 {{/maxdayerror}}
6688ae2b 106 {{/draggable}}>
5ca142dc 107
a7ed05e7
AN
108 <a data-action="view-event" data-event-id="{{id}}" href="{{url}}" title="{{name}}">
109 <span class="badge badge-circle calendar_event_{{calendareventtype}}">
110 &nbsp;
111 </span>
112 {{> core_calendar/event_icon}}
b8c05345 113 <span class="eventname">{{{name}}}</span>
a7ed05e7 114 </a>
64ff737a
AN
115 </li>
116 {{/underway}}
5ca142dc
RW
117 {{/events}}
118 </ul>
119 </div>
a4f94944 120 {{/hasevents}}
64ff737a 121 </div>
3ec69c2e 122 <div class="d-md-none hidden-desktop hidden-tablet">
a4f94944 123 {{#hasevents}}
79dff187 124 <a data-action="view-day-link" href="{{viewdaylink}}" class="day" title="{{viewdaylinktitle}}">{{mday}}</a>
a4f94944
RW
125 {{/hasevents}}
126 {{^hasevents}}
5ca142dc
RW
127 <div data-region="day-content">
128 {{mday}}
129 </div>
a4f94944 130 {{/hasevents}}
64ff737a
AN
131 </div>
132 </td>
133 {{/days}}
134 {{#postpadding}}
135 <td class="dayblank">&nbsp;</td>
136 {{/postpadding}}
137 </tr>
138 {{/weeks}}
139 </tbody>
140 </table>
f6e8cc83 141</div>
5ca142dc 142{{#js}}
fc60d319
AN
143require([
144 'jquery',
145 'core_calendar/month_view_drag_drop',
146 'core_calendar/selectors',
147 'core_calendar/events',
148], function(
149 $,
150 DragDrop,
151 CalendarSelectors,
152 CalendarEvents
153) {
5ca142dc
RW
154 var root = $('#month-detailed-{{uniqid}}');
155 DragDrop.init(root);
fc60d319
AN
156
157 $('body').on(CalendarEvents.filterChanged, function(e, data) {
158 M.util.js_pending("month-detailed-{{uniqid}}-filterChanged");
159 // A filter value has been changed.
160 // Find all matching cells in the popover data, and hide them.
5873e1d2
AN
161 var target = $("#month-detailed-{{uniqid}}").find(CalendarSelectors.eventType[data.type]);
162
163 var transitionPromise = $.Deferred();
164 if (data.hidden) {
165 transitionPromise.then(function() {
166 return target.slideUp('fast').promise();
167 });
168 } else {
169 transitionPromise.then(function() {
170 return target.slideDown('fast').promise();
171 });
172 }
173
174 transitionPromise.then(function() {
175 M.util.js_complete("month-detailed-{{uniqid}}-filterChanged");
176
177 return;
178 });
179
180 transitionPromise.resolve();
fc60d319 181 });
5ca142dc
RW
182});
183{{/js}}