{{!
    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.

    Edwiser RemUI 
    @package    theme_remui
    @copyright  (c) 2018 WisdmLabs (https://wisdmlabs.com/)
    @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 
}}
{{!
    @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="list-group-item m-0 {{^isread}}unread{{/isread}}"
    role="menuitem"
    data-region="message-content-item-container"
    href="{{{contexturl}}}"
    {{^isread}}aria-label="{{#str}} viewunreadmessageswith, message, {{fullname}} {{/str}}"{{/isread}}
    {{#isread}}aria-label="{{#str}} viewmessageswith, message, {{fullname}} {{/str}}"{{/isread}}
    tabindex="0"
    >
    <div class="media">
        <div class="pr-10">
            <span class="avatar avatar-sm avatar-online">
            <img src="{{{profileimageurl}}}" alt="{{{{{fullname}}}}}"/>
            <i></i>
            </span>
        </div>

        <div class="media-body">
            <h6 class="media-heading">{{fullname}}</h6>
            <div class="media-meta hidden-xs-up">
                <time datetime="2017-06-17T20:22:05+08:00">30 minutes ago</time>
            </div>
            <div class="media-detail">
                {{#sentfromcurrentuser}}
                    {{#str}}you, message{{/str}}
                {{/sentfromcurrentuser}}
                {{lastmessage}}
            </div>
        </div>
        <div class="unread-count-container">
            <span class="badge badge-pill badge-important" data-region="unread-count">{{unreadcount}}</span>
        </div>
    </div>
</a>