~melmon/at-channel

1afe87d9c1e30dd7629f2fdc31082b5305645d6d — Melmon 3 years ago ecc93ba
added rudimentary reply function
3 files changed, 42 insertions(+), 6 deletions(-)

A atch/static/js/threadMain.js
M atch/templates/board.html
M atch/templates/thread.html
A atch/static/js/threadMain.js => atch/static/js/threadMain.js +25 -0
@@ 0,0 1,25 @@
function parsePostBodies() {
    /*$('.post.body').each(function(i, el) {
        if (el.text().includes(">")) {

        }
    });*/
}


function addReplyTag(tag) {
    let text = $('textarea#body')
    text.append(">>" + tag)
    text.focus()
    console.log("eeee")
}


function refreshPosts() {

}


$(document).ready(function() {
    parsePostBodies();
})
\ No newline at end of file

M atch/templates/board.html => atch/templates/board.html +3 -3
@@ 1,8 1,5 @@
{% extends "base.html" %}

{% block scripts %}
{% endblock %}

{% block header %}
    <p class="board_list">Boards: [ {% for b in board_list %}<a href="{{ url_for("board.browse_board", uri=b) }}">{{ b }}</a> {% endfor %}]</p>
    <h1>{% block title %}/{{ uri }}/ - {{ name }}{% endblock %}</h1>


@@ 58,4 55,7 @@
            </div>
        </div>
    {% endfor %}
{% endblock %}

{% block scripts %}
{% endblock %}
\ No newline at end of file

M atch/templates/thread.html => atch/templates/thread.html +14 -3
@@ 1,6 1,12 @@
{% extends "base.html" %}


{% block scripts %}
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script type="text/javascript">
        window.THREAD_NUMBER = {{ thread_data["thread_id"] }}
    </script>
    <script src="{{ url_for('static', filename='js/threadMain.js') }}"></script>
{% endblock %}

{% block header %}


@@ 40,10 46,10 @@

    {% for reply in replies %}
        <div class="arrows">
            &gt;&gt;{{ reply["reply_id"] }}
            &gt;&gt;<a href="#{{ reply["reply_id"] }}">{{ reply["reply_id"] }}</a>
        </div>
        <div class="post_container">
                <div class="post header">
                <div class="post header" id="{{ reply["reply_id"] }}">
                    <span class="user">
                        {% if reply["email"] == "" %}
                            {{ reply["name"] }}


@@ 52,6 58,7 @@
                        {% endif %}
                    </span>
                    <span class="date">{{ reply["created"] }}</span>
                    <span class="reply_bt"><a href="#" onclick="return addReplyTag({{ reply["reply_id"] }})">Reply</a></span>
                </div>
                <div class="post body">
                    {% set text = reply["body"].split('\n') %}


@@ 61,4 68,8 @@
                </div>
        </div>
    {% endfor %}
{% endblock %}
\ No newline at end of file
    <span>
        [<a href="#" onclick="refreshPosts()">Refresh</a>]
        [<a href="{{ url_for("board.browse_board", uri=uri) }}">Go Back</a>]
    </span>
{% endblock %}