{% load i18n seahub_tags avatar_tags%}
{% load url from future %}

{# for file/dir 'discuss to grp' #}
{% for msg in messages %}
<li class="msg ovhd" data-id="{{msg.id}}">
<a class="pic fleft" href="{% url 'user_profile' msg.from_email|id_or_email %}">{% avatar msg.from_email 48 %}</a>
<div class="txt">
    <div class="msg-main">
        <a href="{% url 'user_profile' msg.from_email|id_or_email %}">{{ msg.from_email|email2nickname }}</a>
        <span class="time">{{ msg.timestamp|translate_seahub_time }}</span>
        <p class="msg-con">{{ msg.message|seahub_urlize|find_at|linebreaksbr }}</p>
        <span class="say"></span>
    </div>
    <div class="msg-op">
        <div class="replies-op{% if msg.reply_cnt < 4 %} hide{% endif %}" data-rstatus="hide">
            <span class="unfold-replies">{% blocktrans with amount=msg.reply_cnt %}{{ amount }} replies{% endblocktrans %}</span>
            <span class="fold-replies hide">{% trans "Hide replies" %}</span>
        </div>
        {% if msg.reply_cnt == 0 %}
        <ul class="reply-list hide"></ul>
        {% else %}
        <ul class="reply-list">
            {% for r in msg.replies %}
            <li class="reply w100 ovhd">
            {% with id=r.from_email|id_or_email name=r.from_email|email2nickname %}
            <a href="{% url 'user_profile' id %}" class="pic fleft">{% avatar r.from_email 28 %}</a>
            <div class="txt">
                <a href="{% url 'user_profile' id %}">{{ name }}</a>
                <span class="time">{{ r.timestamp|translate_seahub_time }}</span>
                <span class="reply-at op vh" data="{{ name }}">{% trans 'Reply' %}</span>
                <p class="reply-con">{{ r.message|seahub_urlize|find_at }}</p>
            </div>
            {% endwith %}
            </li>
            {% endfor %}
        </ul>
        {% endif %}
        <form action="" method="post" class="reply-form">
            <textarea placeholder="{% trans "Add a reply..." %}" name="message" class="reply-input"></textarea>
            <p class="error hide">{% trans "It can not be blank and should be no more than 2048 characters." %}</p>
            <button type="submit" class="reply-submit hide">{% trans "Submit" %}</button>
            <button type="button" class="reply-cancel hide">{% trans "Cancel" %}</button>
        </form>
    </div>
</div>
</li>
{% endfor %}

