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