Compare commits

..

No commits in common. "19bf98f5b5d9ef1000b008cac90d71be472c790a" and "05cbc03e82122737b956afaa9bbf80987dbdcbae" have entirely different histories.

6 changed files with 16 additions and 33 deletions

View File

@ -7,7 +7,6 @@ from .constants import (
PermissionLevel,
InfoboxKind, InfoboxIcons, InfoboxHTMLClass
)
from datetime import datetime
import os
import time
import secrets
@ -75,11 +74,6 @@ def create_app():
app.register_blueprint(topics_bp)
app.register_blueprint(users_bp)
app.config['SESSION_COOKIE_SECURE'] = True
@app.before_request
def make_session_permanent():
session.permanent = True
@app.context_processor
def inject_constants():
@ -93,8 +87,4 @@ def create_app():
def inject_auth():
return {"is_logged_in": is_logged_in, "get_active_user": get_active_user, "active_user": get_active_user()}
@app.template_filter("ts_datetime")
def ts_datetime(ts, format):
return datetime.utcfromtimestamp(ts).strftime(format)
return app

View File

@ -1,4 +1,4 @@
{% from 'common/macros.html' import infobox with context %}
{% from 'common/infobox.html' import infobox with context %}
<!DOCTYPE HTML>
<html lang="en">
<head>
@ -25,5 +25,4 @@
</footer>
<script src="/static/js/copy-code.js"></script>
<script src="/static/js/ui.js"></script>
<script src="/static/js/date-fmt.js"></script>
</body>

View File

@ -0,0 +1,10 @@
{% macro infobox(message, kind=InfoboxKind.INFO) %}
<div class="{{ "infobox " + InfoboxHTMLClass[kind] }}">
<span>
<div class="infobox-icon-container">
<img src="{{ InfoboxIcons[kind] }}">
</div>
{{ message }}
</span>
</div>
{% endmacro %}

View File

@ -27,18 +27,3 @@
{% endif %}
</div>
{% endmacro %}
{% macro infobox(message, kind=InfoboxKind.INFO) %}
<div class="{{ "infobox " + InfoboxHTMLClass[kind] }}">
<span>
<div class="infobox-icon-container">
<img src="{{ InfoboxIcons[kind] }}">
</div>
{{ message }}
</span>
</div>
{% endmacro %}
{% macro timestamp(unix_ts) %}
<span class="timestamp" data-utc="{{ unix_ts }}">{{ unix_ts | ts_datetime('%Y-%m-%d %H:%M')}} ST</span>
{% endmacro %}

View File

@ -1,4 +1,4 @@
{% from 'common/macros.html' import pager, timestamp %}
{% from 'common/pager.html' import pager %}
{% extends "base.html" %}
{% block title %}browsing topic {{ topic['name'] }}{% endblock %}
{% block content %}
@ -30,11 +30,11 @@
<span>
<span class="thread-title"><a href="{{ url_for("threads.thread", slug=thread['slug']) }}">{{thread['title']}}</a></span>
&bullet;
Started by <a href="{{ url_for("users.page", username=thread['started_by']) }}">{{ thread['started_by'] }}</a> on {{ timestamp(thread['created_at'])}}
Started by <a href="{{ url_for("users.page", username=thread['started_by']) }}">{{ thread['started_by'] }}</a> on ...
</span>
<span>
Latest post by <a href="{{ url_for("users.page", username=thread['latest_post_username']) }}">{{ thread['latest_post_username'] }}</a>
on <a href="{{ url_for("threads.thread", slug=thread['slug']) }}">on {{ timestamp(thread['latest_post_created_at'] )}}</a>:
on ...
</span>
<span class="thread-info-post-preview">
{{ thread['latest_post_content'] }}

View File

@ -1,4 +1,3 @@
{% from 'common/macros.html' import timestamp %}
{% extends 'base.html' %}
{% block title %}{{ target_user.username }}'s profile{% endblock %}
{% block content %}
@ -18,9 +17,9 @@
{% if active_user and active_user.is_mod() and not target_user.is_system() %}
<h1 class="thread-title">Moderation controls</h1>
{% if target_user.is_guest() %}
<p>This user is a guest. They signed up on {{ timestamp(target_user['created_at']) }}</p>
<p>This user is a guest. They signed up on ... </p>
{% else %}
<p>This user signed up on {{ timestamp(target_user['created_at']) }} and was confirmed on {{ timestamp(target_user['confirmed_on']) }}</p>
<p>This user signed up on ... and was confirmed on ...</p>
{% endif %}
{% endif %}
</div>