Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

55 řádky
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 %}