{% import 'base/link.html' as link_base  %}
{% if topics.items %}
{% for topic in topics.items %}
{% set author = topic.author %}
<div class="panel-body" style="padding:6px;border-bottom:1px solid #eee">
    <div class="row">
        <div class="col-md-6 media">
            <div class="media-left">
                <a href="{{ url_for('user.user',user_url=author.username) }}">
                    <img class="media-object img-circle" src="{{ link_base.avatar(author.infor) }}" alt="avatar" style="width:48px;height:48px">
                </a>
            </div>
            <div class="media-body">
                <div class="media-heading"> <a href="{{url_for('topic.topic',uid=topic.uid)}}" style="color:#555">{{ topic.title}}</a></div>
                <span class="visible-xs-inline">
                    <small style="font-size:10px;">由{{ link_base.user(topic.author.username) }}</small>
                    <small style="color:#999;font-size:10px;">
                        {{ topic.publish | timesince }}
                        发布
                    </small>
                </span>
                <div class="hidden-xs">
                    {% for tag in topic.tags %}
                    {{ link_base.tag(tag)}}
                    {% endfor %}
                </div>
            </div>
        </div>
        <div class="col-md-2 hidden-xs" style="padding-top:5px;">
            <small>{{ link_base.user(topic.author.username) }}</small>
            <br/>
            <small style="color:#999;">
                {{ topic.publish | timesince }}
            </small>
        </div>
        <div class="col-md-2  hidden-xs" style="padding:5px 5px 5px 20px;margin:0">
            {% set rep,read = topic.id | get_read_count %}
            <span>{{ rep }}</span> /
            <span style="font-size:12px;color:#999;">
                {{ read }}
            </span>
        </div>
        <div class="col-md-2 hidden-xs" style="padding:5px;margin:0;">
            {% set last_reply = topic.replies.first() %}
            {% if last_reply %}
            <span style="font-size:12px">{{ link_base.user(last_reply.author.username) }}</span>
            <br/>
            <span style="font-size:12px;color:#999;">{{ last_reply.publish | timesince }}</span>
            {% else %}
            <span style="font-size:12px">{{ link_base.user(topic.author.username) }}</span>
            <br/>
            <span style="font-size:12px;color:#999;">{{ topic.publish | timesince }}</span>
            {% endif %}
        </div>
    </div>
</div>
{% endfor %}
{% else %}
<div class="panel-body">
    <span class="text-center" style="display:block;width:100%;color:#999">
        没有帖子
    </span>
</div>
{% endif %}
