MDL-54708 message: add notification popover to nav bar
[moodle.git] / lib / templates / mdl_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 core/mdl_popover
20     This template will render a mdl popover
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 <div class="mdl-popover mdl-popover-{{uniqid}} collapsed {{$classes}}{{/classes}}" {{$attributes}}{{/attributes}}>
37     <div class="mdl-popover-toggle"
38         aria-role="button"
39         aria-controls="mdl-popover-container-{{uniqid}}"
40         aria-haspopup="true"
41         aria-label="{{$togglelabel}}{{#str}}showpopovermenu{{/str}}{{/togglelabel}}"
42         tabindex="0">
43         {{$togglecontent}}{{/togglecontent}}
44     </div>
45     <div {{$containerattributes}}{{/containerattributes}}
46         id="mdl-popover-container-{{uniqid}}"
47         class="mdl-popover-container"
48         aria-expanded="false"
49         aria-hidden="true"
50         aria-label="{{$containerlabel}}{{/containerlabel}}"
51         role="region">
52         <div class="mdl-popover-header-container">
53             <h3 class="mdl-popover-header-text">{{$headertext}}{{/headertext}}</h3>
54             <div class="mdl-popover-header-actions">{{$headeractions}}{{/headeractions}}</div>
55         </div>
56         <div class="mdl-popover-content-container">
57             <div class="mdl-popover-content">
58                 {{$content}}{{/content}}
59             </div>
60             <div class="loading-icon">{{#pix}} y/loading, core, {{#str}} loading, mod_assign {{/str}} {{/pix}}</div>
61         </div>
62     </div>
63 </div>
64 {{#js}}
65 require(['jquery', 'core/mdl_popover_controller'], function($, controller) {
66     var container = $(".mdl-popover-{{uniqid}}");
67     var controller = new controller(container);
68     controller.registerBaseEventListeners();
69 });
70 {{/js}}