v2 overhaul
This commit is contained in:
		@@ -1,61 +1,75 @@
 | 
			
		||||
{% extends "base.html" %}
 | 
			
		||||
{% extends "templates/base.html" %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
    <h2>From {{ post.user.name }} in /{{ post.board.name }}/</h2>
 | 
			
		||||
    <h6>posted at {{ post.created_at }}</h6>
 | 
			
		||||
    {% if post.reference %}
 | 
			
		||||
    <h6><b>ref post:</b> <a href="/posts/{{ post.reference.id }}">{{ post.reference.content }}</a></h6>
 | 
			
		||||
{% block head %}
 | 
			
		||||
    <link rel="stylesheet" href="../static/css/form.css">
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block main_content %}
 | 
			
		||||
    <h1><a href="/users/{{post.user.name}}" class="user-{{post.user.perms}}">{{post.user.name}}</a> posted in <a href="/boards/{{post.board.name}}" class="board-name">/{{post.board.name}}/</a></h1>
 | 
			
		||||
    <h4>posted at <span class="time">{{post.created_at}}</span></h4>
 | 
			
		||||
    {% if post.reference and post.reference.show %}
 | 
			
		||||
        <h4>ref post: <a href="/posts/{{post.reference.id}}">{{post.reference.short_content}}</a></h4>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
    <p>{{ post.content }}</p>
 | 
			
		||||
    {% if session.name == "SYSTEM" %}
 | 
			
		||||
    <h6><a href="/delete/post/{{ post.id }}">Delete</a></h6>
 | 
			
		||||
    {% elif session.name == post.user.name %}
 | 
			
		||||
    <h6><a href="/delete/post/{{ post.id }}">Delete</a></h6>
 | 
			
		||||
    {% if post.attachments %}
 | 
			
		||||
        <h4>{{post.attachments|length}} attachments</h4>
 | 
			
		||||
        <div class="attachments">
 | 
			
		||||
            {% for attachment in post.attachments %}
 | 
			
		||||
                {% if attachment.type == "image" %}
 | 
			
		||||
                    <a href="{{attachment.url}}"><img src="{{attachment.url}}" alt="{{attachment.file_name}}" width="350px"></a>
 | 
			
		||||
                {% elif attachment.type == "video" %}
 | 
			
		||||
                    <video width="350px" controls>
 | 
			
		||||
                        <source src="{{attachment.url}}" type="video/mp4">
 | 
			
		||||
                        Your browser does not support the video tag.
 | 
			
		||||
                    </video>
 | 
			
		||||
                {% elif attachment.type == "audio" %}
 | 
			
		||||
                    <audio controls>
 | 
			
		||||
                        <source src="{{attachment.url}}" type="audio/mpeg">
 | 
			
		||||
                        Your browser does not support the audio element.
 | 
			
		||||
                    </audio>
 | 
			
		||||
                {% else %}
 | 
			
		||||
                    <a href="{{attachment.url}}">{{attachment.file_name}}</a>
 | 
			
		||||
                {% endif %}
 | 
			
		||||
            {% endfor %}
 | 
			
		||||
        </div>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
    <p>{{post.content}}</p>
 | 
			
		||||
    <h6>
 | 
			
		||||
        {% if session.name == "SYSTEM" %}
 | 
			
		||||
            <a href="/delete/post/{{ post.id }}">Delete</a>
 | 
			
		||||
        {% elif session.name == post.user.name %}
 | 
			
		||||
            <a href="/delete/post/{{ post.id }}">Delete</a>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    </h6>
 | 
			
		||||
    {% if session.user_id %}
 | 
			
		||||
        <br>
 | 
			
		||||
        <h3>Reply to this post</h3>
 | 
			
		||||
        <form action="/post" method="POST" enctype="multipart/form-data">
 | 
			
		||||
            <input type="hidden" name="board_id" value="{{ post.board.id }}">
 | 
			
		||||
            <input type="hidden" name="reference" value="{{ post.id }}">
 | 
			
		||||
            <input type="hidden" name="type" value="comment">
 | 
			
		||||
            <textarea name="content" placeholder="Content" required></textarea>
 | 
			
		||||
            <input type="file" name="attachments" multiple>
 | 
			
		||||
            <button type="submit">Post</button>
 | 
			
		||||
        </form>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
    <br>
 | 
			
		||||
 | 
			
		||||
    <h3>Replies:</h3>
 | 
			
		||||
    
 | 
			
		||||
    <ul class="posts">
 | 
			
		||||
        {% for reply in post.replies %}
 | 
			
		||||
    <h1>{{ post.replies }} Replies</h1>
 | 
			
		||||
    <ul class="post-list">
 | 
			
		||||
        {% for post in replies %}
 | 
			
		||||
            <li>
 | 
			
		||||
                <h3>From {{ reply.user.name }} in /{{ reply.board.name }}/</h3>
 | 
			
		||||
                <h6>posted at {{ reply.created_at }}</h6>
 | 
			
		||||
                <p>{{ reply.short_content }}</p>
 | 
			
		||||
                <h6><a href="/posts/{{ reply.id }}">View Reply</a>
 | 
			
		||||
                    {% if session.name == "SYSTEM" %}
 | 
			
		||||
                     | <a href="/delete/post/{{ reply.id }}">Delete</a>
 | 
			
		||||
                    {% elif session.name == post.user.name %}
 | 
			
		||||
                     | <a href="/delete/post/{{ reply.id }}">Delete</a>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                </h6>
 | 
			
		||||
                {% include "templates/post.html" %}
 | 
			
		||||
            </li>
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
        {% if post.replies|length == 0 %}
 | 
			
		||||
        <li>No replies found.</li>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    </ul>
 | 
			
		||||
    <div id="nav">
 | 
			
		||||
        <h5>Page {{ page }}</h5>
 | 
			
		||||
        {% if page > 1 %}
 | 
			
		||||
        <h5><a href="/posts/{{ post.id }}?page={{ page - 1 }}">Previous Page</a></h5>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
        
 | 
			
		||||
        {% if post.replies|length == 10 %}
 | 
			
		||||
        <h5><a href="/posts/{{ post.id }}?page={{ page + 1 }}">Next Page</a></h5>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    </div>
 | 
			
		||||
    <br>
 | 
			
		||||
    <form method="POST" action="/post">
 | 
			
		||||
        <input type="hidden" name="ref" value="{{ post.id }}">
 | 
			
		||||
        <input type="hidden" name="board" value="{{ post.board.id }}">
 | 
			
		||||
        <input type="hidden" name="redirect" value="/posts/{{ post.id }}">
 | 
			
		||||
        <label for="content">Reply:</label>
 | 
			
		||||
        <textarea id="content" name="content" rows="4" cols="50" required></textarea>
 | 
			
		||||
        <br>
 | 
			
		||||
        <button type="submit">Post</button>
 | 
			
		||||
    </form>
 | 
			
		||||
    {% if error %}
 | 
			
		||||
        <p style="color: red;">{{ error }}</p>
 | 
			
		||||
    {% if total_pages > 0 %}
 | 
			
		||||
        <div id="nav">
 | 
			
		||||
            <h5>Page {{ page }} of {{ total_pages }}</h5>
 | 
			
		||||
            {% if page > 1 %}
 | 
			
		||||
                <h5><a href="/posts/{{ post.id }}?page={{ page - 1 }}">Previous Page</a></h5>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
            {% if replies|length == 10 %}
 | 
			
		||||
                <h5><a href="/posts/{{ post.id }}?page={{ page + 1 }}">Next Page</a></h5>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
        </div>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
		Reference in New Issue
	
	Block a user