lots of things
This commit is contained in:
@ -1,14 +1,34 @@
|
||||
{% macro render_media_list(media_list, thumb_width=150) -%}
|
||||
{% macro render_media_list(media_list, thumb_width=150, current_user=None) -%}
|
||||
{% if media_list %}
|
||||
<ul class="media-thumbnails">
|
||||
<div class="row">
|
||||
{% for media in media_list %}
|
||||
<li>
|
||||
<img src="{{ url_for('media.media_file', filename=media.file_url) }}" width="{{ thumb_width }}">
|
||||
{% if media.caption %}
|
||||
<p>{{ media.caption }}</p>
|
||||
{% endif %}
|
||||
</li>
|
||||
<div class="col-md-3 mb-4" data-media-id="{{ media.id }}">
|
||||
<div class="card shadow-sm">
|
||||
<img src="{{ url_for('media.media_file', filename=media.file_url.split('/')[-1]) }}"
|
||||
class="card-img-top" style="width:100%; height:auto;">
|
||||
{% if media.caption %}
|
||||
<div class="card-body p-2">
|
||||
<p class="card-text text-center">{{ media.caption }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card-footer d-flex justify-content-between align-items-center p-2">
|
||||
<button class="btn btn-sm btn-outline-danger heart-btn" data-id="{{ media.id }}">
|
||||
❤️ <span class="heart-count">{{ media.imageheart_set|length }}</span>
|
||||
</button>
|
||||
{% if current_user and (current_user.id == media.uploader_id or current_user.role == 'admin') %}
|
||||
<form method="POST" action="{{ url_for('media.set_featured_image', media_id=media.id) }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
{% if media.featuredimage %}
|
||||
<button class="btn btn-sm btn-outline-secondary" type="submit">★ Featured</button>
|
||||
{% else %}
|
||||
<button class="btn btn-sm btn-outline-primary" type="submit">☆ Set Featured</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
{%- endmacro %}
|
||||
|
Reference in New Issue
Block a user