MDL-69401 book: Limit character length in chapter title
[moodle.git] / calendar / templates / month_mini.mustache
1 {{!
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/>.
16 }}
17 {{!
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:
25     * none
27     Data attributes required for JS:
28     * none
30     Example context (json):
31     {
32     }
33 }}
34 <div{{!
35     }} id="month-mini-{{date.year}}-{{date.month}}-{{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"{{!
43     }}>
44     {{> core/overlay_loading}}
45     <table class="minicalendar calendartable">
46         <caption class="calendar-controls">
47             {{#includenavigation}}
48                 <a{{!
49                     }} href="#"{{!
50                     }} class="arrow_link previous"{{!
51                     }} title="{{#str}}monthprev, calendar{{/str}}"{{!
52                     }} data-year="{{previousperiod.year}}"{{!
53                     }} data-month="{{previousperiod.mon}}"{{!
54                 }}>
55                     <span class="arrow">{{{larrow}}}</span>
56                 </a>
57                 <span class="hide"> | </span>
58                 <span class="current">
59                     <a href="{{{url}}}" title="{{#str}}monththis, calendar{{/str}}">{{periodname}}</a>
60                 </span>
61                 <span class="hide"> | </span>
62                 <a{{!
63                     }} href="#"{{!
64                     }} class="arrow_link next"{{!
65                     }} title="{{#str}}monthnext, calendar{{/str}}"{{!
66                     }} data-year="{{nextperiod.year}}"{{!
67                     }} data-month="{{nextperiod.mon}}"{{!
68                 }}>
69                     <span class="arrow">{{{rarrow}}}</span>
70                 </a>
71             {{/includenavigation}}
72             {{^includenavigation}}
73                 <h3>
74                     <a href="{{{url}}}" title="{{#str}}monththis, calendar{{/str}}">{{periodname}}</a>
75                 </h3>
76             {{/includenavigation}}
77         </caption>
78         <thead>
79           <tr>
80                 {{# daynames }}
81                 <th class="header text-xs-center" scope="col" aria-label="{{fullname}}">
82                     {{shortname}}
83                 </th>
84                 {{/ daynames }}
85             </tr>
86         </thead>
87         <tbody>
88 {{#weeks}}
89             <tr data-region="month-view-week">
90                 {{#prepadding}}
91                     <td class="dayblank">&nbsp;</td>
92                 {{/prepadding}}
93                 {{#days}}
94                     <td class="day text-center{{!
95                             This is the list of additional classes to display.
97                             This cell is for today.
98                             }}{{#istoday}} today{{/istoday}}{{!
100                             This day falls on a weekend.
101                             }}{{#isweekend}} weekend{{/isweekend}}{{!
103                             There is at least one event.
104                             }}{{#events.0}} hasevent{{/events.0}}{{!
106                             There are events on this day which span multiple days.
107                             }}{{#durationevents.0}} duration{{/durationevents.0}}{{!
108                             }}{{#durationevents}} duration_{{.}}{{/durationevents}}{{!
109                             }}{{#islastday}} duraction_finish{{/islastday}}{{!
111                             These event types fall on this day.
112                             }}{{#calendareventtypes}}{{!
113                             }} calendar_event_{{.}}{{!
114                             }}{{/calendareventtypes}}{{!
116                             This day contains the last day of an event.
117                             }}{{#haslastdayofevent}}{{!
118                             }} duration_finish{{!
119                             }}{{/haslastdayofevent}}{{!
120                         }}"{{!
122                         Add data-eventtype-[eventtype] data attributes.
123                         These are used to show and hide events using the filter.
124                         }}{{#calendareventtypes}}{{!
125                         }} data-eventtype-{{.}}="1"{{!
126                         }}{{/calendareventtypes}}{{!
128                         This is the timestamp for this month.
129                         }} data-day-timestamp="{{timestamp}}"{{!
130                     }}>{{!
131                         }}{{#popovertitle}}
132                             {{< core_calendar/minicalendar_day_link }}
133                                 {{$day}}{{mday}}{{/day}}
134                                 {{$url}}{{viewdaylink}}{{/url}}
135                                 {{$title}}{{popovertitle}}{{/title}}
136                                 {{$nocontent}}{{#str}}eventnone, calendar{{/str}}{{/nocontent}}
137                                 {{$content}}
138                                     {{#events}}
139                                         <div data-popover-eventtype-{{normalisedeventtype}}="1">
140                                             {{> core_calendar/event_icon}}
141                                             {{{popupname}}}
142                                         </div>
143                                     {{/events}}
144                                 {{/content}}
145                             {{/ core_calendar/minicalendar_day_link }}
146                         {{/popovertitle}}{{!
147                         }}{{^popovertitle}}
148                             {{mday}}
149                         {{/popovertitle}}{{!
150                     }}</td>
151                 {{/days}}
152                 {{#postpadding}}
153                     <td class="dayblank">&nbsp;</td>
154                 {{/postpadding}}
155             </tr>
156 {{/weeks}}
157         </tbody>
158     </table>
159 </div>
160 {{#js}}
161 require([
162     'jquery',
163     'core_calendar/selectors',
164     'core_calendar/events',
165 ], function(
166     $,
167     CalendarSelectors,
168     CalendarEvents
169 ) {
171     $('body').on(CalendarEvents.filterChanged, function(e, data) {
172         M.util.js_pending("month-mini-{{uniqid}}-filterChanged");
173         // A filter value has been changed.
174         // Find all matching cells in the popover data, and hide them.
175         $("#month-mini-{{date.year}}-{{date.month}}-{{uniqid}}")
176             .find(CalendarSelectors.popoverType[data.type])
177             .toggleClass('hidden', !!data.hidden);
178         M.util.js_complete("month-mini-{{uniqid}}-filterChanged");
179     });
180 });
181 {{/js}}