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_area
|
|
|
19 |
|
|
|
20 |
This template will render the notification area on the notifications
|
|
|
21 |
page.
|
|
|
22 |
|
|
|
23 |
Classes required for JS:
|
|
|
24 |
* none
|
|
|
25 |
|
|
|
26 |
Data attributes required for JS:
|
|
|
27 |
* All data attributes are required
|
|
|
28 |
|
|
|
29 |
Context variables required for this template:
|
|
|
30 |
* userid The logged in user id
|
|
|
31 |
* offset The offset amound of the notification list
|
|
|
32 |
* limit The limit amount for the notification list
|
|
|
33 |
* notificationid The specific notification to select
|
|
|
34 |
|
|
|
35 |
Example context (json):
|
|
|
36 |
{
|
|
|
37 |
"userid":3
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
}}
|
|
|
41 |
<div class="notification-area" data-region="notification-area" data-user-id="{{userid}}">
|
|
|
42 |
<div class="control-area" data-region="control-area">
|
|
|
43 |
<div class="header"></div>
|
|
|
44 |
<div class="content" data-region="content"></div>
|
|
|
45 |
<div class="empty-text">{{#str}} nonotifications, message {{/str}}</div>
|
|
|
46 |
{{> core/loading }}
|
|
|
47 |
</div>
|
|
|
48 |
<div class="content-area" data-region="content-area">
|
|
|
49 |
<div class="toggle-mode">
|
|
|
50 |
<button class="btn btn-link" data-action="toggle-mode">{{#str}} back {{/str}}</button>
|
|
|
51 |
</div>
|
|
|
52 |
<div class="header" data-region="header"></div>
|
|
|
53 |
<div class="content" data-region="content"></div>
|
|
|
54 |
<div class="empty-text">{{#str}} selectnotificationtoview, message {{/str}}</div>
|
|
|
55 |
<div class="footer" data-region="footer"></div>
|
|
|
56 |
</div>
|
|
|
57 |
</div>
|
|
|
58 |
{{#js}}
|
|
|
59 |
require(['jquery', 'message_popup/notification_area_control_area', 'message_popup/notification_area_content_area'],
|
|
|
60 |
function($, ControlArea, ContentArea) {
|
|
|
61 |
|
|
|
62 |
var userId = {{userid}};
|
|
|
63 |
var controlArea = new ControlArea($('[data-region="control-area"]'), userId);
|
|
|
64 |
{{#offset}}
|
|
|
65 |
controlArea.setOffset({{.}});
|
|
|
66 |
{{/offset}}
|
|
|
67 |
{{#limit}}
|
|
|
68 |
controlArea.setLimit({{.}});
|
|
|
69 |
{{/limit}}
|
|
|
70 |
{{#notificationid}}
|
|
|
71 |
controlArea.loadMoreNotifications().done(function() {
|
|
|
72 |
controlArea.showNotification({{.}});
|
|
|
73 |
});
|
|
|
74 |
{{/notificationid}}
|
|
|
75 |
{{^notificationid}}
|
|
|
76 |
controlArea.loadMoreNotifications();
|
|
|
77 |
{{/notificationid}}
|
|
|
78 |
|
|
|
79 |
new ContentArea($('[data-region="content-area"]'), userId);
|
|
|
80 |
});
|
|
|
81 |
{{/js}}
|