Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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 core_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{{!
35
    }} id="month-mini-{{date.year}}-{{date.mon}}-{{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"{{!
1441 ariadna 51
                    }} title="{{#str}}monthprevwithname, calendar, {{previousperiodname}}{{/str}}"{{!
1 efrain 52
                    }} data-year="{{previousperiod.year}}"{{!
53
                    }} data-month="{{previousperiod.mon}}"{{!
1441 ariadna 54
                    }} aria-label="{{#str}}monthprevwithname, calendar, {{previousperiodname}}{{/str}}" {{!
1 efrain 55
                }}>
1441 ariadna 56
                    <span class="arrow" aria-hidden="true">{{{larrow}}}</span>
1 efrain 57
                </a>
58
                <span class="hide"> | </span>
59
                <span class="current">
60
                    <a href="{{{url}}}" title="{{#str}}monththis, calendar{{/str}}">{{periodname}}</a>
61
                </span>
62
                <span class="hide"> | </span>
63
                <a{{!
64
                    }} href="#"{{!
65
                    }} class="arrow_link next"{{!
1441 ariadna 66
                    }} title="{{#str}}monthnextwithname, calendar, {{nextperiodname}}{{/str}}"{{!
1 efrain 67
                    }} data-year="{{nextperiod.year}}"{{!
68
                    }} data-month="{{nextperiod.mon}}"{{!
1441 ariadna 69
                    }} aria-label="{{#str}}monthnextwithname, calendar, {{nextperiodname}}{{/str}}" {{!
1 efrain 70
                }}>
1441 ariadna 71
                    <span class="arrow" aria-hidden="true">{{{rarrow}}}</span>
1 efrain 72
                </a>
73
            {{/includenavigation}}
74
            {{^includenavigation}}
75
                <h3>
76
                    <a href="{{{url}}}" title="{{#str}}monththis, calendar{{/str}}">{{periodname}}</a>
77
                </h3>
78
            {{/includenavigation}}
79
        </caption>
80
        <thead>
81
          <tr>
82
                {{# daynames }}
83
                <th class="header text-xs-center">
1441 ariadna 84
                    <span class="visually-hidden">{{fullname}}</span>
1 efrain 85
                    <span aria-hidden="true">{{shortname}}</span>
86
                </th>
87
                {{/ daynames }}
88
            </tr>
89
        </thead>
90
        <tbody>
91
{{#weeks}}
92
            <tr data-region="month-view-week">
93
                {{#prepadding}}
94
                    <td class="dayblank">&nbsp;</td>
95
                {{/prepadding}}
96
                {{#days}}
97
                    <td class="day text-center{{!
98
                            This is the list of additional classes to display.
99
 
100
                            This cell is for today.
101
                            }}{{#istoday}} today{{/istoday}}{{!
102
 
103
                            This day falls on a weekend.
104
                            }}{{#isweekend}} weekend{{/isweekend}}{{!
105
 
106
                            There is at least one event.
107
                            }}{{#events.0}} hasevent{{/events.0}}{{!
108
 
109
                            There are events on this day which span multiple days.
110
                            }}{{#durationevents.0}} duration{{/durationevents.0}}{{!
111
                            }}{{#durationevents}} duration_{{.}}{{/durationevents}}{{!
112
                            }}{{#islastday}} duraction_finish{{/islastday}}{{!
113
 
114
                            These event types fall on this day.
115
                            }}{{#calendareventtypes}}{{!
116
                            }} calendar_event_{{.}}{{!
117
                            }}{{/calendareventtypes}}{{!
118
 
119
                            This day contains the last day of an event.
120
                            }}{{#haslastdayofevent}}{{!
121
                            }} duration_finish{{!
122
                            }}{{/haslastdayofevent}}{{!
123
                        }}"{{!
124
 
125
                        Add data-eventtype-[eventtype] data attributes.
126
                        These are used to show and hide events using the filter.
127
                        }}{{#calendareventtypes}}{{!
128
                        }} data-eventtype-{{.}}="1"{{!
129
                        }}{{/calendareventtypes}}{{!
130
 
131
                        This is the timestamp for this month.
132
                        }} data-day-timestamp="{{timestamp}}"{{!
133
                    }}>{{!
1441 ariadna 134
                        }}<span class="visually-hidden">{{daytitle}}</span>
1 efrain 135
                        {{#popovertitle}}
136
                            {{< core_calendar/minicalendar_day_link }}
137
                                {{$day}}{{mday}}{{/day}}
138
                                {{$url}}{{viewdaylink}}{{/url}}
139
                                {{$title}}{{popovertitle}}{{/title}}
140
                                {{$nocontent}}{{#str}}eventnone, calendar{{/str}}{{/nocontent}}
141
                                {{$content}}
142
                                    {{#events}}
143
                                        <div data-popover-eventtype-{{normalisedeventtype}}="1">
144
                                            {{> core_calendar/event_icon}}
145
                                            {{{popupname}}}
146
                                        </div>
147
                                    {{/events}}
148
                                {{/content}}
149
                            {{/ core_calendar/minicalendar_day_link }}
150
                        {{/popovertitle}}{{!
151
                        }}{{^popovertitle}}
152
                            <span aria-hidden="true">{{mday}}</span>
153
                        {{/popovertitle}}{{!
154
                    }}</td>
155
                {{/days}}
156
                {{#postpadding}}
157
                    <td class="dayblank">&nbsp;</td>
158
                {{/postpadding}}
159
            </tr>
160
{{/weeks}}
161
        </tbody>
162
    </table>
163
</div>
164
{{#js}}
165
require([
166
    'jquery',
167
    'core_calendar/selectors',
168
    'core_calendar/events',
169
], function(
170
    $,
171
    CalendarSelectors,
172
    CalendarEvents
173
) {
174
 
175
    $('body').on(CalendarEvents.filterChanged, function(e, data) {
176
        M.util.js_pending("month-mini-{{uniqid}}-filterChanged");
177
        // A filter value has been changed.
178
        // Find all matching cells in the popover data, and hide them.
179
        $("#month-mini-{{date.year}}-{{date.mon}}-{{uniqid}}")
180
            .find(CalendarSelectors.popoverType[data.type])
181
            .toggleClass('hidden', !!data.hidden);
182
        M.util.js_complete("month-mini-{{uniqid}}-filterChanged");
183
    });
184
});
185
{{/js}}