You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.7 KiB

{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template message_output_popup/message_content_item
This template will render the message content item for the
navigation bar message menu.
Classes required for JS:
* none
Data attributes required for JS:
* All data attributes are required
Context variables required for this template:
* isread If the message is read or not
* contexturl The link to the message on the messages page
* fullname The name of the sender
* profileimageurl The URL for the sender's profile image
* sentfromcurrentuser Was the last message sent by the current user
* lastmessage The message text
* unreadcount The number of unread messages in this conversation
Example context (json):
{
"isread": true,
"contexturl": "http://www.moodle.com",
"fullname": "Some Person",
"profileimageurl": "http://www.moodle.com",
"sentfromcurrentuser": false,
"lastmessage": "Hello, this is Some Person!",
"unreadcount": 1
}
}}
<a class="content-item-container {{^isread}}unread{{/isread}}"
data-region="message-content-item-container"
role="listitem"
href="{{{contexturl}}}"
{{^isread}}aria-label="{{#str}} viewunreadmessageswith, message, {{fullname}} {{/str}}"{{/isread}}
{{#isread}}aria-label="{{#str}} viewmessageswith, message, {{fullname}} {{/str}}"{{/isread}}
tabindex="0">
<div class="content-item">
<div class="profile-image-container">
<img src="{{{profileimageurl}}}" />
</div>
<div class="content-item-body">
<h3>{{fullname}}</h3>
<p>
{{#sentfromcurrentuser}}
<span data-region="last-message-user">{{#str}}you, message{{/str}}</span>
{{/sentfromcurrentuser}}
{{lastmessage}}
</p>
</div>
<div class="unread-count-container">
<span data-region="unread-count" class="badge badge-danger">{{unreadcount}}</span>
</div>
</div>
</a>