Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

55 linhas
2.5 KiB

{% macro photo_card(photo) %}
<div class="photo-card card">
<a class="card-thumbnail" href="{{ url_for('main.show_photo', photo_id=photo.id) }}">
<img class="card-img-top portrait" src="{{ url_for('main.get_image', filename=photo.filename_s) }}">
</a>
<div class="card-body">
<span class="oi oi-star"></span> {{ photo.collectors|length }}
<span class="oi oi-comment-square"></span> {{ photo.comments|length }}
</div>
</div>
{% endmacro %}
{% macro user_card(user) %}
<div class="user-card text-center">
<a href="{{ url_for('user.index', username=user.username) }}">
<img class="rounded avatar-m" src="{{ url_for('main.get_avatar', filename=user.avatar_m) }}">
</a>
<h6>
<a href="{{ url_for('user.index', username=user.username) }}">{{ user.name }}</a>
</h6>
{{ follow_area(user) }}
</div>
{% endmacro %}
{% macro follow_area(user) %}
{% if current_user.is_authenticated %}
{% if user != current_user %}
{% if current_user.is_following(user) %}
<form class="inline" method="post"
action="{{ url_for('user.unfollow', username=user.username, next=request.full_path) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="btn btn-dark btn-sm">取消关注</button>
{% if current_user.is_followed_by(user) %}
<p class="badge badge-light">互相关注</p>
{% endif %}
</form>
{% else %}
<form class="inline" method="post"
action="{{ url_for('user.follow', username=user.username, next=request.full_path) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="btn btn-primary btn-sm">关注</button>
{% if current_user.is_followed_by(user) %}
<p class="badge badge-light">关注了你</p>
{% endif %}
</form>
{% endif %}
{% endif %}
{% else %}
<form class="inline" method="post"
action="{{ url_for('user.follow', username=user.username) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="btn btn-primary btn-sm">关注</button>
</form>
{% endif %}
{% endmacro %}