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_output_popup/notification_content_item
|
|
|
19 |
|
|
|
20 |
This template will render the notification content item for the
|
|
|
21 |
navigation bar notification menu.
|
|
|
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 |
* contexturl A link to the notification resource
|
|
|
31 |
* read If the notification is read or not
|
|
|
32 |
* subject The subject text
|
|
|
33 |
* id Notification id
|
|
|
34 |
* iconurl The URL for the notification icon
|
|
|
35 |
* shortenedsubject A shortened version of subject text
|
|
|
36 |
* timecreatedpretty Pretty formatted time stamp
|
|
|
37 |
* viewmoreurl The link to the full notification
|
|
|
38 |
|
|
|
39 |
Example context (json):
|
|
|
40 |
{
|
|
|
41 |
"contexturl": "http://www.moodle.com",
|
|
|
42 |
"read": true,
|
|
|
43 |
"subject": "You have a notification",
|
|
|
44 |
"id": 1,
|
|
|
45 |
"iconurl": "http://www.moodle.com",
|
|
|
46 |
"shortenedsubject": "You have a...",
|
|
|
47 |
"timecreatedpretty": "5 minutes ago",
|
|
|
48 |
"viewmoreurl": "http://www.moodle.com"
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
}}
|
|
|
52 |
<div class="content-item-container notification mx-0 {{^read}}unread{{/read}}"
|
|
|
53 |
data-region="notification-content-item-container"
|
|
|
54 |
data-id="{{id}}"
|
|
|
55 |
role="listitem">
|
|
|
56 |
|
|
|
57 |
{{#contexturl}}
|
|
|
58 |
<a class="context-link" href="{{{.}}}" data-action="content-item-link"
|
|
|
59 |
{{/contexturl}}
|
|
|
60 |
{{^contexturl}}
|
|
|
61 |
<div tabindex="0"
|
|
|
62 |
{{/contexturl}}
|
|
|
63 |
{{#read}}aria-label="{{subject}}"{{/read}}
|
|
|
64 |
{{^read}}aria-label="{{#str}} unreadnotification, message, {{subject}} {{/str}}"{{/read}}>
|
|
|
65 |
|
|
|
66 |
<div class="content-item-body">
|
|
|
67 |
<div class="notification-image">
|
|
|
68 |
<img src="{{{iconurl}}}" alt="{{#str}}notificationimage, message{{/str}}"/>
|
|
|
69 |
</div>
|
|
|
70 |
<div class="notification-message">{{shortenedsubject}}</div>
|
|
|
71 |
</div>
|
|
|
72 |
<div class="content-item-footer">
|
|
|
73 |
<div class="timestamp">{{timecreatedpretty}}</div>
|
|
|
74 |
</div>
|
|
|
75 |
|
|
|
76 |
{{#viewmoreurl}}
|
|
|
77 |
<a href="{{{.}}}" class="view-more" data-action="view-more">
|
|
|
78 |
{{#str}} viewfullnotification, message {{/str}}
|
|
|
79 |
</a>
|
|
|
80 |
{{/viewmoreurl}}
|
|
|
81 |
{{#contexturl}}
|
|
|
82 |
</a>
|
|
|
83 |
{{/contexturl}}
|
|
|
84 |
{{^contexturl}}
|
|
|
85 |
</div>
|
|
|
86 |
{{/contexturl}}
|
|
|
87 |
</div>
|