Update templates/category.html
parent
827175598e
commit
94e315701d
|
@ -3,25 +3,44 @@
|
||||||
{% block title %}{{ category.category_name }} Category{% endblock %}
|
{% block title %}{{ category.category_name }} Category{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="container">
|
<div class="container mt-4">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<h1>{{ category.category_name }}</h1>
|
<h1>{{ category.category_name }}</h1>
|
||||||
<a href="{{ url_for('create_post', category_id=category.id) }}" class="btn btn-primary mb-3">Create Post</a>
|
<a href="{{ url_for('create_post', category_id=category.id) }}" class="btn btn-primary mb-3">Create Post</a></br></br>
|
||||||
<div class="card mt-4">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="list-group">
|
|
||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
<a href="{{ url_for('view_post', post_id=post.id) }}" class="list-group-item list-group-item-action">
|
<div class="card mb-3">
|
||||||
<h5 class="mb-1">{{ post.post_name }}</h5>
|
<div class="card-header">
|
||||||
<p class="mb-1">{{ post.text }}</p>
|
<small class="text-muted">Created by {{ post.created_by }} - {{ post.creation_date.strftime('%Y-%m-%d %H:%M') }}</small>
|
||||||
<small>Created by {{ post.created_by }} - {{ post.creation_date }}</small>
|
</div>
|
||||||
</a>
|
<div class="card-body">
|
||||||
|
<h3 class="card-title"><a href="{{ url_for('view_post', category_name=category.category_name.lower(), post_id=post.id) }}">{{ post.post_name }}</a></h3>
|
||||||
|
{% for media in post.media %}
|
||||||
|
<div class="mt-3">
|
||||||
|
<img src="/uploads/{{ media.filename }}" alt="Media" class="img-fluid">
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<p class="card-text mt-3">{{ post.text }}</p>
|
||||||
|
<hr>
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<div>
|
||||||
|
<a href="{{ url_for('upvote_post', post_id=post.id) }}" class="btn btn-sm btn-success"><i class="fas fa-arrow-up"></i> Upvote ({{ post.upvotes }})</a>
|
||||||
|
<a href="{{ url_for('downvote_post', post_id=post.id) }}" class="btn btn-sm btn-danger"><i class="fas fa-arrow-down"></i> Downvote ({{ post.downvotes }})</a>
|
||||||
|
</div>
|
||||||
|
{% if post.comments %}
|
||||||
|
<small class="text-muted">{{ post.comments.count() }} Comments</small>
|
||||||
|
{% else %}
|
||||||
|
<small class="text-muted">0 Comments</small>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue