hanze/programmeerles-ouderen

pgmles/templates/post.html in dev_2
Repositories | Summary | Log | Files

post.html (2081B) download


 1{% extends "layout.html" %}
 2{% block content %}
 3    <article class="media content-section">
 4        <img class="rounded-circle article-img" src="{{ url_for('static', filename='profile_pics/' + post.author.image_file) }}">
 5        <div class="media-body">
 6        <div class="article-metadata">
 7            <a class="mr-2" href="{{ url_for('user_posts', username=post.author.username)}}">{{ post.author.username }}</a>
 8            <small class="text-muted">{{ post.date_posted.strftime('%Y-%m-%d') }}</small>
 9            {% if post.author == current_user %}
10                <div>
11                    <a class="btn btn-secondary btn-sm mt-1 mb-1" href="{{ url_for('update_post', post_id=post.id)}}">Update</a>
12                    <button type="button" class="btn btn-danger btn-sm m-1" data-toggle="modal" data-target="#deletemodal">Delete</button>
13                </div>
14            {% endif %}
15        </div>
16        <h2 class="article-title">{{ post.title }}</h2>
17        <p class="article-content">{{ post.content }}</p>
18        </div>
19    </article>
20    <!-- Modal -->
21    <div class="modal fade" id="deletemodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
22        <div class="modal-dialog" role="document">
23        <div class="modal-content">
24            <div class="modal-header">
25            <h5 class="modal-title" id="deletemodal">Delete Post?</h5>
26            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
27                <span aria-hidden="true">&times;</span>
28            </button>
29            </div>
30            <div class="modal-body">
31                Are you sure you want to delete this post?
32            </div>
33            <div class="modal-footer">
34            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
35            <form action="{{ url_for('delete_post', post_id=post.id) }}" method="POST">
36                <input class="btn btn-danger" type="submit" value="Delete">
37            </div>
38        </div>
39        </div>
40    </div>
41{% endblock content %}