Initial commit

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-05-03 18:02:04 -07:00
commit 126db039e2
27 changed files with 1033 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>{% block title %}{% if title %}{{title}}{% else %}Index{% endif %}{% endblock %}</title>
<link rel="stylesheet" href="{% static 'board/style.css' %}">
<script src="{% static 'board/jquery.js' %}"></script>
<script src="{% static 'board/post.js' %}"></script>
</head>
<body>
<main>
{% block content %}{% endblock content %}
</main>
</body>
</html>

View File

@@ -0,0 +1,57 @@
{% extends "board/base.html" %}
{% block title %}
{% with title=board.url %}
{{ block.super }}
{% endwith %}
{% endblock title %}
{% block content %}
{# board header #}
<div class="row">
<div class="column">&nbsp;</div>
<div class="column">
<h1>/{{ board.url }}/ - {{ board.name }}</h1>
</div>
<div class="column">&nbsp;</div>
</div>
<hr />
{# post creation form #}
<div class="row">
<div class="column">&nbsp;</div>
<div class="column">
<div class="row">
<h2>Create a new thread</h2>
</div>
<div class="row">
<form method="post" action="{% url 'board:board_detail' url=board.url %}">
{% csrf_token %}
<table>
{{ form.as_table }}
<tr><td>&nbsp;</td><td><input type="submit" value="Submit" /></td></tr>
</table>
</form>
</div>
</div>
<div class="column">&nbsp;</div>
</div>
<hr />
{# posts #}
{% for post in threads %}
<div class="row post" id="p{{post.id}}">
{# TODO we need some way to parameterize the last N threads #}
{% with reply_link=True replies_elided=post.replies.all|length|add:"-3" %}
{% include "board/post_snippet.html" %}
{% endwith %}
{# get the last 3 replies #}
{% for post in post.replies.all|dictsortreversed:"id"|slice:":3" reversed %}
<div class="row reply" id="p{{post.id}}">
{% include "board/post_snippet.html" %}
</div>
{% endfor %}
</div>
<hr />
{% endfor %}
{% endblock content %}

View File

@@ -0,0 +1,9 @@
{% extends "board/base.html" %}
{% block content %}
<div class="row">
<h1>/{{ board.url }}/</h1>
</div>
<div class="row">
{% include "board/post_create_form.html" %}
</div>
{% endblock content %}

View File

@@ -0,0 +1,43 @@
{% extends "board/base.html" %}
{% block title %}
{% with title=board.url %}
{{ block.super }}
{% endwith %}
{% endblock title %}
{% block content %}
{# board header #}
<div class="row">
<div class="column">&nbsp;</div>
<div class="column">
<h1>/{{ board.url }}/ - {{ board.name }}</h1>
</div>
<div class="column">&nbsp;</div>
</div>
<hr />
{# post creation form #}
<div class="row">
<div class="column">&nbsp;</div>
<div class="column">
<form method="post" action="{% url 'board:post_detail' url=board.url id=post.id %}">
{% csrf_token %}
<table>
{{ form.as_table }}
<tr><td>&nbsp;</td><td><input type="submit" value="Submit" /></td></tr>
</table>
</form>
</div>
<div class="column">&nbsp;</div>
</div>
<hr />
{# posts #}
<div class="row post">
{% include "board/post_snippet.html" %}
{% for post in post.replies.all %}
<div class="row reply">
{% include "board/post_snippet.html" %}
</div>
{% endfor %}
</div>
{% endblock content %}

View File

@@ -0,0 +1,21 @@
{% load post_body %}
<div id="p{{post.id}}">
{# TODO images #}
<a href="#p{{post.id}}">#.</a>
<span class="post_id">{{post.id}}</span>
{% if post.subject %}
<span class="post_subject">{{post.subject}}</span>
{% endif %}
by <span class="post_name">{{post.name|default:"Anonymous"}}</span>
at {{post.created}}
{% if reply_link %}
[<a href="{{post.get_absolute_url}}">Reply</a>]
{% endif %}
{% if replies_elided > 0 %}
<br/>
<span class="replies_elided">
({{replies_elided}} replies elided, click reply to view)
</span>
{% endif %}
<p class="post_body">{{post|post_body|safe}}</p>
</div>