Fixed homepage

This commit is contained in:
Pünkösd Marcell 2020-11-28 23:20:26 +01:00
parent ed6d23c536
commit ea7ca747ef
2 changed files with 24 additions and 22 deletions

View File

@ -1,25 +1,27 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %} {% block content %}
{% if images %} {% if items %}
<div class="row mx-2"> <div class="row mx-2">
{% for image in images %} {% for item in items %}
<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">
<div class="card">
<a href="{{ url_for('ItemView:index', id=image.id) }}"> <div class="card">
<img src="{{image.preview}}" class="img-fluid" style="padding: 30px" alt="{{image.name}}"> <h5 class="card-header">{{ item.name }} by {{ item.uploader.name }}</h5>
</a> <div class="card-body">
<div class="card-body"> <a href="{{ url_for('ItemView:get', id_=item.id) }}">
<h5 class="card-title">{{image.creator}}</h5> <img src="{{ url_for('ContentView:preview', id_=item.id) }}" class="img-fluid"
<p class="card-text"> alt="{{ item.name }}">
{{image.name}} </a>
</p> </div>
<a href="{{ url_for('download', id=image.id) }}" class="btn btn-primary" target="_blank">Download Now</a> <div class="card-footer text-muted">
</div> {{ item.upload_date }}
</div>
</div>
</div>
{% endfor %}
</div> </div>
</div> {% else %}
{% endfor %} <p>No images available.</p>
</div> {% endif %}
{% else %}
<p>No images available.</p>
{% endif %}
{% endblock %} {% endblock %}

View File

@ -20,4 +20,4 @@ class IndexView(FlaskView):
def index(self): def index(self):
items = Item.query.all() items = Item.query.all()
return render_template("index.html", images=items) return render_template("index.html", items=items)