123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- {% macro title(topicId,replies) -%}
- <div class="panel-heading">
- {{ _('Received %(count)s replies',count=replies.total) }}
- <ul class="pull-right list-inline reply-order">
- <li><a href="{{ url_for('topic.topic',topicId=topicId,orderby='time')}}"> <i class="icon icon-time"></i>{{_('time')}}</a></li>
- <li><a href="{{ url_for('topic.topic',topicId=topicId,orderby='like')}}"> <i class="icon icon-thumbs-up"></i>{{_('likers')}}</a></li>
- </ul>
- </div>
- {%- endmacro %}
- {% macro body(reply) -%}
- {% import 'base/link.html' as link %}
- {% set author = reply.author %}
- <div class="panel-body media" id="reply-{{ reply.id }}" style="border-bottom:1px solid #eee;margin:0">
- <div class="media-left">
- <a href="{{ url_for('user.user',username=author.username) }}">
- {{ link.user_avatar(author) }}
- </a>
- </div>
- <div class="media-body">
- <small class="media-heading" style="color:#999">
- <span>{{ link.user(author.username)}}</span>
- <span>{{ reply.created_at | timesince }}</span>
- <a name="reply{{ reply.id }}" class="anchor" href="#reply{{ num }}" aria-hidden="true">#{{ num }}</a>
- </small>
- <div class="reply-content">
- {{ reply.content | safe_clean }}
- </div>
- </div>
- <div class="media-right">
- {{ like(reply) }}
- </div>
- <div class="media-right">
- <a href="javascript:void(0);" style="color:#ccc;padding:0" class="reply-author btn btn-sm" data-id="{{ reply.author.username }}" title="回复">
- <i class="icon-reply"></i>
- </a>
- </div>
- </div>
- {%- endmacro %}
- {% macro like(reply) -%}
- {% if g.user.is_authenticated and g.user in reply.likers %}
- <a href="javascript:void(0);" style="padding:0" class="like-reply btn btn-sm like-active" data-id="{{ reply.id}}" title="取消赞">
- <i class="icon-thumbs-up"></i>
- <span class="reply-count">{{ reply.likers.count() }}</span>
- </a>
- {% else %}
- <a href="javascript:void(0);" style="padding:0" class="like-reply btn btn-sm like-no-active" data-id="{{ reply.id}}" title="赞">
- <i class="icon-thumbs-up"></i>
- <span class="reply-count">{{ reply.likers.count() }}</span>
- </a>
- {% endif %}
- {%- endmacro %}
- {% macro reply_form(form) -%}
- <div class="panel panel-default">
- {% if g.user.is_authenticated %}
- <div class="panel-heading"> {{ _('Reply this topic') }} </div>
- <div class="panel-body">
- <form action="{{ url_for('reply.list',topicId=topicId)}}" method="POST">
- {{ form.hidden_tag() }}
- {{ form.content(class='form-control',rows=4)}}
- <button class="btn btn-sm btn-primary" type="submit" style="margin-top:10px;">{{ _('Post reply') }}</button>
- </form>
- </div>
- {% else %}
- <div class="panel-body" style="border:1px dashed #337ab7;margin:5px;">
- <span class="text-center" style="display:block;width:100%;color:#999">
- <span class="glyphicon glyphicon-lock" aria-hidden="true" style="font-size:16px;"></span>
- {{_('You need')}} <a href="{{ url_for('auth.login') }}">{{ _('Login')}}</a> {{_('before you can reply.')}}
- </span>
- </div>
- {% endif %}
- </div>
- {%- endmacro %}
|