boards/templates.py

117 lines
3.2 KiB
Python

from bottle import SimpleTemplate
from config import root
index_page = SimpleTemplate(open(f"{root}/html/index.html").read())
board_page = SimpleTemplate(open(f"{root}/html/board.html").read())
random_page = SimpleTemplate(open(f"{root}/html/random.html").read())
collection_page = SimpleTemplate(open(f"{root}/html/collection.html").read())
thread_page = SimpleTemplate(open(f"{root}/html/thread.html").read())
user_page = SimpleTemplate(open(f"{root}/html/user.html").read())
signin_page = SimpleTemplate(open(f"{root}/html/signin.html").read())
signup_page = SimpleTemplate(open(f"{root}/html/signup.html").read())
error_page = SimpleTemplate(open(f"{root}/html/error.html").read())
account = SimpleTemplate("""<a href="/u/{{!user}}"><b>{{!user}}</b></a>""")
board_box = SimpleTemplate("""
<div class="block">
<a href="/.{{board}}">{{board.upper()}}</a>
<span style="float:right;">
Threads: {{threads}}
</span>
<hr>
<strong>
{{description}}&nbsp;
</strong>
</div>
""")
board_post = SimpleTemplate("""
<div class="thread" id="{{!id}}">
<a href="/.{{!board}}/thread/{{!id}}"><span style="font-size:20px;">{{subject}}</span></a>
<b style="float:right;">{{!author}}</b>
<strong>
{{!date}}{{!time}}<a href="/.{{!board}}/thread/{{!id}}"> ID.{{!id}}</a>
</strong>
<hr>
<div class="files">{{!files}}</div>
</div>
""")
random_post = SimpleTemplate("""
<div class="thread" id="{{!id}}">
<a style="text-align:center;font-size:20px;color:#7352E6;" href=".{{board}}" >{{!board.upper()}}</a>
<a href="/.{{!board}}/thread/{{!id}}"><span style="font-size:20px;">{{subject}}</span></a>
<b style="float:right;">{{!author}}</b>
<strong>
{{!date}}{{!time}}<a href="/.{{!board}}/thread/{{!id}}"> ID.{{!id}}</a>
</strong>
<hr>
<div class="files">{{!files}}</div>
</div>
""")
thread_post = SimpleTemplate("""
<div class="thread" id="{{!id}}">
<b style="float:right;">{{!author}}</b>
<div>
<strong>
{{!sddate}} {{!time}} <a href="/.{{!board}}/thread/{{!post}}#{{!id}}">ID.{{!id}}</a>
</strong>
<hr>
</div>
<div class="comment">{{!comment}}</div>
<div class="files">{{!files}}</div>
</div>
""")
board_file = SimpleTemplate("""
<div class="file">
<img class="box" src="{{!src}}">
</div>
""")
thread_file = SimpleTemplate("""
<label>
<input class="toggle" type="checkbox" {{!"checked" if checked else ""}}>
<div class="file thumb">
<p>File: <a href="/files/{{!name}}" target="_blank" >{{!name}}</a></p>
<img src="{{!src}}">
</div>
</label>
""")
user_content = SimpleTemplate("""
<div style="text-align:center;" class="thread">
{{!page}}
</div>
""")
user_form = SimpleTemplate("""
<form method="post" autocomplete="off">
<table>
<tr>
<td>Comment:</td>
<td><textarea name="content" required >{{!page}}</textarea></td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit"/>
</td>
</tr>
</table>
</form>
""")
default_content = """
<div style="text-align:center;" class="thread">
Nothing here yet...
</div>
"""
signout_link = '<a href="/logout">SIGNOUT</a>'
signin_link = '<a href="/login">SIGNIN</a>'