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 message_popup/notification_popover
|
|
|
19 |
|
|
|
20 |
This template will render the notification popover for the navigation bar.
|
|
|
21 |
|
|
|
22 |
Classes required for JS:
|
|
|
23 |
* none
|
|
|
24 |
|
|
|
25 |
Data attributes required for JS:
|
|
|
26 |
* All data attributes are required
|
|
|
27 |
|
|
|
28 |
Context variables required for this template:
|
|
|
29 |
* userid the logged in user id
|
|
|
30 |
* urls The URLs for the popover
|
|
|
31 |
|
|
|
32 |
Example context (json):
|
|
|
33 |
{
|
|
|
34 |
"userid": 3,
|
|
|
35 |
"urls": {
|
|
|
36 |
"preferences": "http://www.moodle.com"
|
|
|
37 |
}
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
}}
|
|
|
41 |
{{< core/popover_region }}
|
|
|
42 |
{{$classes}}popover-region-notifications{{/classes}}
|
|
|
43 |
{{$attributes}}id="nav-notification-popover-container" data-userid="{{userid}}"{{/attributes}}
|
|
|
44 |
|
|
|
45 |
{{$togglelabel}}{{!
|
|
|
46 |
}}{{^unreadcount}} {{#str}} shownotificationwindownonew, message {{/str}} {{/unreadcount}} {{!
|
|
|
47 |
}}{{#unreadcount}} {{#str}} shownotificationwindowwithcount, message, {{.}} {{/str}} {{/unreadcount}} {{!
|
|
|
48 |
}}{{/togglelabel}}
|
|
|
49 |
{{$togglecontent}}
|
1441 |
ariadna |
50 |
{{#pix}} i/notifications, core {{/pix}}
|
1 |
efrain |
51 |
<div
|
|
|
52 |
class="count-container {{^unreadcount}}hidden{{/unreadcount}}"
|
|
|
53 |
data-region="count-container"
|
|
|
54 |
aria-hidden=true
|
|
|
55 |
>
|
|
|
56 |
{{unreadcount}}
|
|
|
57 |
</div>
|
|
|
58 |
{{/togglecontent}}
|
1441 |
ariadna |
59 |
{{$containerrole}}dialog{{/containerrole}}
|
|
|
60 |
{{$containerattributes}}
|
|
|
61 |
aria-modal="true"
|
|
|
62 |
tabindex="-1"
|
|
|
63 |
{{/containerattributes}}
|
1 |
efrain |
64 |
{{$containerlabel}}{{#str}} notificationwindow, message {{/str}}{{/containerlabel}}
|
|
|
65 |
|
|
|
66 |
{{$headertext}}{{#str}} notifications, message {{/str}}{{/headertext}}
|
|
|
67 |
{{$headeractions}}
|
1441 |
ariadna |
68 |
<a class="mark-all-read-button btn btn-sm btn-link m-0 py-0 icon-no-margin"
|
1 |
efrain |
69 |
href="#"
|
|
|
70 |
title="{{#str}} markallread {{/str}}"
|
|
|
71 |
data-action="mark-all-read"
|
|
|
72 |
role="button"
|
|
|
73 |
aria-label="{{#str}} markallread {{/str}}">
|
|
|
74 |
<span class="normal-icon">{{#pix}} t/markasread, core {{/pix}}</span>
|
|
|
75 |
{{> core/loading }}
|
1441 |
ariadna |
76 |
{{! Records notifications being marked as read state message. }}
|
|
|
77 |
<span aria-live="polite" class="visually-hidden" data-region="notification-read-feedback"></span>
|
1 |
efrain |
78 |
</a>
|
|
|
79 |
{{# urls.preferences }}
|
|
|
80 |
<a href="{{{ . }}}"
|
|
|
81 |
title="{{#str}} notificationpreferences, message {{/str}}"
|
1441 |
ariadna |
82 |
aria-label="{{#str}} notificationpreferences, message {{/str}}"
|
|
|
83 |
class="btn btn-sm btn-link m-0 py-0 icon-no-margin" >
|
1 |
efrain |
84 |
{{#pix}} i/settings, core {{/pix}}</a>
|
|
|
85 |
{{/ urls.preferences }}
|
1441 |
ariadna |
86 |
<button type="button" class="btn btn-sm btn-link m-0 py-0 icon-no-margin" aria-label="{{#str}}closebuttontitle{{/str}}" title="{{#str}}closebuttontitle{{/str}}" data-action="close-notification-popover">
|
|
|
87 |
{{#pix}}i/window_close{{/pix}}
|
|
|
88 |
</button>
|
1 |
efrain |
89 |
{{/headeractions}}
|
|
|
90 |
|
|
|
91 |
{{$content}}
|
|
|
92 |
<div class="all-notifications"
|
|
|
93 |
data-region="all-notifications"
|
|
|
94 |
role="log"
|
|
|
95 |
aria-busy="false"
|
|
|
96 |
aria-atomic="false"
|
|
|
97 |
aria-relevant="additions"></div>
|
|
|
98 |
<div class="empty-message" tabindex="0" data-region="empty-message">{{#str}} nonotifications, message {{/str}}</div>
|
|
|
99 |
{{/content}}
|
|
|
100 |
{{/ core/popover_region }}
|
|
|
101 |
{{#js}}
|
|
|
102 |
require(['jquery', 'message_popup/notification_popover_controller'], function($, Controller) {
|
|
|
103 |
var container = $('#nav-notification-popover-container');
|
|
|
104 |
var controller = new Controller(container);
|
|
|
105 |
controller.registerEventListeners();
|
|
|
106 |
controller.registerListNavigationEventListeners();
|
|
|
107 |
});
|
|
|
108 |
{{/js}}
|