MDL-54708 message: add notification popover to nav bar
[moodle.git] / message / templates / notification_popover.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 message/notification_popover
20     This template will render the notification popover for the navigation bar.
22     Classes required for JS:
23     * none
25     Data attributes required for JS:
26     * none
28     Context variables required for this template:
29     * userid the logged in user id
31     Example context (json):
32     {
33     }
35 }}
36 {{< core/mdl_popover }}
37     {{$classes}}mdl-popover-notifications unread-only{{/classes}}
38     {{$attributes}}id="nav-notification-popover-container" data-userid="{{userid}}"{{/attributes}}
40     {{$togglelabel}}{{#str}} shownotificationwindownonew, message {{/str}}{{/togglelabel}}
41     {{$togglecontent}}
42         {{#pix}} i/notifications, core, {{#str}} togglenotificationmenu, message {{/str}} {{/pix}}
43         <div class="count-container hidden"></div>
44     {{/togglecontent}}
46     {{$containerlabel}}{{#str}} notificationwindow, message {{/str}}{{/containerlabel}}
48     {{$headertext}}{{#str}} notifications, message {{/str}}{{/headertext}}
49     {{$headeractions}}
50         <div class="fancy-toggle on" tabindex="0" aria-label="{{#str}} showallnotifications, message {{/str}}">
51             <div class="slider-container"><div class="slider"></div></div>
52             <div class="off-text">{{#str}} all {{/str}}</div>
53             <div class="on-text">{{#str}} new {{/str}}</div>
54         </div>
55         <a id="mark-all-read-button"
56             href="#"
57             data-toggle="tooltip"
58             data-placement="top"
59             data-original-title="{{#str}} markallread {{/str}}"
60             aria-role="button">
61             <span class="normal-icon">{{#pix}} t/markasread, core, {{#str}} markallread {{/str}} {{/pix}}</span>
62             <span class="loading-icon">{{#pix}} y/loading, core, {{#str}} loading, mod_assign {{/str}} {{/pix}}</span>
63         </a>
64         <a href="{{{urls.preferences}}}"
65             data-toggle="tooltip"
66             data-placement="top"
67             data-original-title="{{#str}} notificationpreferences, message {{/str}}">
68             {{#pix}} i/settings, core, {{#str}} notificationpreferences, message {{/str}} {{/pix}}
69         </a>
70     {{/headeractions}}
72     {{$content}}
73         <div class="all-notifications" role="log" aria-busy="false" aria-atomic="false" aria-relevant="additions"></div>
74         <div class="empty-message" tabindex="0">{{#str}} nonotifications, message {{/str}}</div>
75         <div class="unread-notifications" role="log" aria-busy="false" aria-atomic="false" aria-relevant="additions"></div>
76         <div class="empty-message" tabindex="0">{{#str}} nonewnotifications, message {{/str}}</div>
77     {{/content}}
78 {{/ core/mdl_popover }}
79 {{#js}}
80 require(['jquery', 'message/notification_popover_controller'], function($, controller) {
81     var container = $('#nav-notification-popover-container');
82     var controller = new controller(container);
83     controller.registerEventListeners();
84     controller.registerListNavigationEventListeners();
85 });
86 {{/js}}