Added purchases to profile

This commit is contained in:
Pünkösd Marcell 2020-11-28 23:25:48 +01:00
parent ea7ca747ef
commit cd687381ea

View File

@ -8,6 +8,7 @@
</div> </div>
<br> <br>
{% if current_user.uploads %} {% if current_user.uploads %}
<div class="row"><h2>Your uploads</h2></div>
<div class="row mx-2"> <div class="row mx-2">
{% for item in current_user.uploads %} {% for item in current_user.uploads %}
<div class="col-12 col-sm-6 col-md-4 px-2 mb-3"> <div class="col-12 col-sm-6 col-md-4 px-2 mb-3">
@ -21,16 +22,35 @@
{{ item.name }} {{ item.name }}
</p> </p>
<a href="{{ url_for('ContentView:caff', id_=item.id) }}" <a href="{{ url_for('ContentView:caff', id_=item.id) }}"
class="btn btn-primary" target="_blank">Download</a> class="btn btn-primary" target="_self">Download</a>
</div> </div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% else %}
<p>No images available.</p>
{% endif %} {% endif %}
<div class="row mx-2">
<div class="row"><h2>Your purchases</h2></div>
<div class="row mx-2">
{% for purchase in current_user.purchases %}
<div class="col-12 col-sm-6 col-md-4 px-2 mb-3">
<div class="card">
<div class="card-body">
<a href="{{ url_for('ItemView:get', id_=purchase.item.id) }}"><img
src="{{ url_for('ContentView:preview', id_=purchase.item.id) }}"
class="img-fluid" alt="{{ purchase.item.name }}"
/></a>
<p class="card-text">
{{ purchase.item.name }} by {{ purchase.item.uploader.name }}
</p>
<a href="{{ url_for('ContentView:caff', id_=purchase.item.id) }}"
class="btn btn-primary" target="_self">Download</a>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %} {% else %}
<p><a href="{{ url_for_security('login') }}">Log in</a> to view your profile.</p> <p><a href="{{ url_for_security('login') }}">Log in</a> to view your profile.</p>
{% endif %} {% endif %}