Compare commits
No commits in common. "19bf98f5b5d9ef1000b008cac90d71be472c790a" and "05cbc03e82122737b956afaa9bbf80987dbdcbae" have entirely different histories.
19bf98f5b5
...
05cbc03e82
@ -7,7 +7,6 @@ from .constants import (
|
|||||||
PermissionLevel,
|
PermissionLevel,
|
||||||
InfoboxKind, InfoboxIcons, InfoboxHTMLClass
|
InfoboxKind, InfoboxIcons, InfoboxHTMLClass
|
||||||
)
|
)
|
||||||
from datetime import datetime
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import secrets
|
import secrets
|
||||||
@ -75,11 +74,6 @@ def create_app():
|
|||||||
app.register_blueprint(topics_bp)
|
app.register_blueprint(topics_bp)
|
||||||
app.register_blueprint(users_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
|
@app.context_processor
|
||||||
def inject_constants():
|
def inject_constants():
|
||||||
@ -93,8 +87,4 @@ def create_app():
|
|||||||
def inject_auth():
|
def inject_auth():
|
||||||
return {"is_logged_in": is_logged_in, "get_active_user": get_active_user, "active_user": get_active_user()}
|
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
|
return app
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% from 'common/macros.html' import infobox with context %}
|
{% from 'common/infobox.html' import infobox with context %}
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@ -25,5 +25,4 @@
|
|||||||
</footer>
|
</footer>
|
||||||
<script src="/static/js/copy-code.js"></script>
|
<script src="/static/js/copy-code.js"></script>
|
||||||
<script src="/static/js/ui.js"></script>
|
<script src="/static/js/ui.js"></script>
|
||||||
<script src="/static/js/date-fmt.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
10
app/templates/common/infobox.html
Normal file
10
app/templates/common/infobox.html
Normal 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 %}
|
@ -27,18 +27,3 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% 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 %}
|
|
@ -1,4 +1,4 @@
|
|||||||
{% from 'common/macros.html' import pager, timestamp %}
|
{% from 'common/pager.html' import pager %}
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}browsing topic {{ topic['name'] }}{% endblock %}
|
{% block title %}browsing topic {{ topic['name'] }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@ -30,11 +30,11 @@
|
|||||||
<span>
|
<span>
|
||||||
<span class="thread-title"><a href="{{ url_for("threads.thread", slug=thread['slug']) }}">{{thread['title']}}</a></span>
|
<span class="thread-title"><a href="{{ url_for("threads.thread", slug=thread['slug']) }}">{{thread['title']}}</a></span>
|
||||||
•
|
•
|
||||||
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>
|
||||||
<span>
|
<span>
|
||||||
Latest post by <a href="{{ url_for("users.page", username=thread['latest_post_username']) }}">{{ thread['latest_post_username'] }}</a>
|
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>
|
||||||
<span class="thread-info-post-preview">
|
<span class="thread-info-post-preview">
|
||||||
{{ thread['latest_post_content'] }}
|
{{ thread['latest_post_content'] }}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
{% from 'common/macros.html' import timestamp %}
|
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% block title %}{{ target_user.username }}'s profile{% endblock %}
|
{% block title %}{{ target_user.username }}'s profile{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@ -18,9 +17,9 @@
|
|||||||
{% if active_user and active_user.is_mod() and not target_user.is_system() %}
|
{% if active_user and active_user.is_mod() and not target_user.is_system() %}
|
||||||
<h1 class="thread-title">Moderation controls</h1>
|
<h1 class="thread-title">Moderation controls</h1>
|
||||||
{% if target_user.is_guest() %}
|
{% 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 %}
|
{% 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 %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user