render motds in topic and topics views
This commit is contained in:
@@ -186,6 +186,7 @@ def create_app():
|
|||||||
return {
|
return {
|
||||||
'get_post_url': get_post_url,
|
'get_post_url': get_post_url,
|
||||||
'get_prefers_theme': get_prefers_theme,
|
'get_prefers_theme': get_prefers_theme,
|
||||||
|
'get_motds': MOTD.get_all,
|
||||||
}
|
}
|
||||||
|
|
||||||
@app.template_filter("ts_datetime")
|
@app.template_filter("ts_datetime")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{% from 'common/icons.html' import icn_image, icn_spoiler, icn_info, icn_lock, icn_warn, icn_error, icn_bookmark %}
|
{% from 'common/icons.html' import icn_image, icn_spoiler, icn_info, icn_lock, icn_warn, icn_error, icn_bookmark, icn_megaphone %}
|
||||||
{% macro pager(current_page, page_count) %}
|
{% macro pager(current_page, page_count) %}
|
||||||
{% set left_start = [1, current_page - 5] | max %}
|
{% set left_start = [1, current_page - 5] | max %}
|
||||||
{% set right_end = [page_count, current_page + 5] | min %}
|
{% set right_end = [page_count, current_page + 5] | min %}
|
||||||
@@ -61,6 +61,19 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro motd(motd_obj) %}
|
||||||
|
<div class="motd">
|
||||||
|
<div class="motd-icon-container contain-svg">
|
||||||
|
{{ icn_megaphone(80) }}
|
||||||
|
<i><abbr title="Message of the Day">MOTD</abbr></i>
|
||||||
|
</div>
|
||||||
|
<div class="motd-content-container">
|
||||||
|
<div class="motd-title">{{ motd_obj.title }}</div>
|
||||||
|
<div class="motd-body">{{ motd_obj.body_rendered | safe}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro timestamp(unix_ts) -%}
|
{% macro timestamp(unix_ts) -%}
|
||||||
<span class="timestamp" data-utc="{{ unix_ts }}">{{ unix_ts | ts_datetime('%Y-%m-%d %H:%M')}} <abbr title="Server Time">ST</abbr></span>
|
<span class="timestamp" data-utc="{{ unix_ts }}">{{ unix_ts | ts_datetime('%Y-%m-%d %H:%M')}} <abbr title="Server Time">ST</abbr></span>
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{% from 'common/macros.html' import pager, timestamp %}
|
{% from 'common/macros.html' import pager, timestamp, motd %}
|
||||||
{% from 'common/icons.html' import icn_lock, icn_sticky %}
|
{% from 'common/icons.html' import icn_lock, icn_sticky %}
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}browsing topic {{ topic['name'] }}{% endblock %}
|
{% block title %}browsing topic {{ topic['name'] }}{% endblock %}
|
||||||
@@ -27,6 +27,14 @@
|
|||||||
{{ infobox("This topic is locked.;Only moderators can create new threads.", InfoboxKind.INFO) }}
|
{{ infobox("This topic is locked.;Only moderators can create new threads.", InfoboxKind.INFO) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{%- with motds = get_motds() -%}
|
||||||
|
{%- if motds -%}
|
||||||
|
{%- for motd_obj in motds -%}
|
||||||
|
{{- motd(motd_obj) -}}
|
||||||
|
{%- endfor -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endwith -%}
|
||||||
|
|
||||||
{% if threads_list | length == 0 %}
|
{% if threads_list | length == 0 %}
|
||||||
<p>There are no threads in this topic.</p>
|
<p>There are no threads in this topic.</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{% from 'common/icons.html' import icn_lock %}
|
{% from 'common/icons.html' import icn_lock %}
|
||||||
{% from 'common/macros.html' import timestamp %}
|
{% from 'common/macros.html' import timestamp, motd %}
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<nav class="darkbg">
|
<nav class="darkbg">
|
||||||
@@ -9,6 +9,13 @@
|
|||||||
<a class="linkbutton" href={{ url_for("mod.sort_topics") }}>Sort topics</a>
|
<a class="linkbutton" href={{ url_for("mod.sort_topics") }}>Sort topics</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</nav>
|
</nav>
|
||||||
|
{%- with motds = get_motds() -%}
|
||||||
|
{%- if motds -%}
|
||||||
|
{%- for motd_obj in motds -%}
|
||||||
|
{{- motd(motd_obj) -}}
|
||||||
|
{%- endfor -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endwith -%}
|
||||||
{% if topic_list | length == 0 %}
|
{% if topic_list | length == 0 %}
|
||||||
<p>There are no topics.</p>
|
<p>There are no topics.</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@@ -1381,3 +1381,30 @@ footer {
|
|||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.motd {
|
||||||
|
display: flex;
|
||||||
|
background-color: #c1ceb1;
|
||||||
|
border: 2px outset rgb(217.26, 220.38, 213.42);
|
||||||
|
padding: 10px 15px;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.motd-icon-container {
|
||||||
|
display: flex;
|
||||||
|
min-width: 80px;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.motd-content-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-self: center;
|
||||||
|
flex-grow: 1;
|
||||||
|
padding-right: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.motd-title {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1382,6 +1382,33 @@ footer {
|
|||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.motd {
|
||||||
|
display: flex;
|
||||||
|
background-color: #503250;
|
||||||
|
border: 2px outset #503250;
|
||||||
|
padding: 10px 15px;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.motd-icon-container {
|
||||||
|
display: flex;
|
||||||
|
min-width: 80px;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.motd-content-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-self: center;
|
||||||
|
flex-grow: 1;
|
||||||
|
padding-right: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.motd-title {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
|
|
||||||
#topnav {
|
#topnav {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
border: 10px solid rgb(40, 40, 40);
|
border: 10px solid rgb(40, 40, 40);
|
||||||
|
|||||||
@@ -1382,6 +1382,33 @@ footer {
|
|||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.motd {
|
||||||
|
display: flex;
|
||||||
|
background-color: #f27a5a;
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 6px 8px;
|
||||||
|
margin: 6px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.motd-icon-container {
|
||||||
|
display: flex;
|
||||||
|
min-width: 80px;
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.motd-content-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-self: center;
|
||||||
|
flex-grow: 1;
|
||||||
|
padding-right: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.motd-title {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
|
|
||||||
#topnav {
|
#topnav {
|
||||||
border-top-left-radius: 16px;
|
border-top-left-radius: 16px;
|
||||||
border-top-right-radius: 16px;
|
border-top-right-radius: 16px;
|
||||||
|
|||||||
@@ -1335,3 +1335,37 @@ $bookmark_dropdown_items_container_max_height: 300px !default;
|
|||||||
max-height: $bookmark_dropdown_items_container_max_height;
|
max-height: $bookmark_dropdown_items_container_max_height;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$motd_background_color: $ACCENT_COLOR !default;
|
||||||
|
$motd_border: 2px outset $LIGHT !default;
|
||||||
|
$motd_padding: $MEDIUM_PADDING $MEDIUM_BIG_PADDING !default;
|
||||||
|
$motd_margin: $MEDIUM_PADDING 0 !default;
|
||||||
|
.motd {
|
||||||
|
display: flex;
|
||||||
|
background-color: $motd_background_color;
|
||||||
|
border: $motd_border;
|
||||||
|
padding: $motd_padding;
|
||||||
|
margin: $motd_margin;
|
||||||
|
}
|
||||||
|
|
||||||
|
$motd_icon_min_width: 80px !default;
|
||||||
|
$motd_icon_padding_right: $MEDIUM_BIG_PADDING !default;
|
||||||
|
.motd-icon-container {
|
||||||
|
display: flex;
|
||||||
|
min-width: $motd_icon_min_width;
|
||||||
|
padding-right: $motd_icon_padding_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
$motd_content_padding_right: 25% !default;
|
||||||
|
.motd-content-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-self: center;
|
||||||
|
flex-grow: 1;
|
||||||
|
padding-right: $motd_content_padding_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.motd-title {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ $crit: #d53232;
|
|||||||
$post_content_background: $dark_accent,
|
$post_content_background: $dark_accent,
|
||||||
|
|
||||||
$thread_info_background_color: $dark_accent,
|
$thread_info_background_color: $dark_accent,
|
||||||
|
$motd_background_color: $lightish_accent,
|
||||||
|
|
||||||
$post_reactions_background: $lightish_accent,
|
$post_reactions_background: $lightish_accent,
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ $br: 16px;
|
|||||||
$usercard_border: none,
|
$usercard_border: none,
|
||||||
$usercard_border_right: none,
|
$usercard_border_right: none,
|
||||||
$thread_locked_border: 1px solid black,
|
$thread_locked_border: 1px solid black,
|
||||||
|
$motd_border: 1px solid black,
|
||||||
|
|
||||||
$SETTINGS_WIDTH: 60%,
|
$SETTINGS_WIDTH: 60%,
|
||||||
$PAGE_SIDE_MARGIN: 50px,
|
$PAGE_SIDE_MARGIN: 50px,
|
||||||
|
|||||||
Reference in New Issue
Block a user