From f8101e57c1307d6201f7787112c174e3ac1bfb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Fri, 21 Nov 2025 05:38:51 +0300 Subject: [PATCH] make icons macros instead of svg files --- README.md | 2 +- THIRDPARTY.md | 5 ++-- app/__init__.py | 1 - app/constants.py | 7 ----- app/templates/common/icons.html | 49 ++++++++++++++++++++++++++++++++ app/templates/common/macros.html | 19 +++++++++---- app/templates/topics/topic.html | 5 ++-- app/templates/topics/topics.html | 3 +- data/static/misc/error.svg | 5 ---- data/static/misc/image.svg | 5 ---- data/static/misc/info.svg | 5 ---- data/static/misc/lock.svg | 5 ---- data/static/misc/spoiler.svg | 5 ---- data/static/misc/sticky.svg | 5 ---- data/static/misc/warn.svg | 5 ---- 15 files changed, 71 insertions(+), 55 deletions(-) create mode 100644 app/templates/common/icons.html delete mode 100644 data/static/misc/error.svg delete mode 100644 data/static/misc/image.svg delete mode 100644 data/static/misc/info.svg delete mode 100644 data/static/misc/lock.svg delete mode 100644 data/static/misc/spoiler.svg delete mode 100644 data/static/misc/sticky.svg delete mode 100644 data/static/misc/warn.svg diff --git a/README.md b/README.md index 311f2a7..5d0c936 100644 --- a/README.md +++ b/README.md @@ -60,4 +60,4 @@ $ python -m app.run ``` # icons -the icons in the `data/static/misc/` folder are by [Gabriele Malaspina](https://www.figma.com/community/file/1136337054881623512/iconcino-v2-0-0-free-icons-cc0-1-0-license) +the icons in the `app/templates/common/icons.html` file are by [Gabriele Malaspina](https://www.figma.com/community/file/1136337054881623512/iconcino-v2-0-0-free-icons-cc0-1-0-license) diff --git a/THIRDPARTY.md b/THIRDPARTY.md index d39d8b9..6ac3edf 100644 --- a/THIRDPARTY.md +++ b/THIRDPARTY.md @@ -25,12 +25,11 @@ Designers: Paul James Miller ## ICONCINO -Affected files: [`data/static/misc/error.svg`](./data/static/misc/error.svg) [`data/static/misc/image.svg`](./data/static/misc/image.svg) [`data/static/misc/info.svg`](./data/static/misc/info.svg) [`data/static/misc/lock.svg`](./data/static/misc/lock.svg) [`data/static/misc/spoiler.svg`](./data/static/misc/spoiler.svg) [`data/static/misc/sticky.svg`](./data/static/misc/sticky.svg) [`data/static/misc/warn.svg`](./data/static/misc/warn.svg) +Affected files: [`app/templates/common/icons.html`](./app/templates/common/icons.html) URL: https://www.figma.com/community/file/1136337054881623512/iconcino-v2-0-0-free-icons-cc0-1-0-license Copyright: Gabriele Malaspina Designers: Gabriele Malaspina -License: CC0 1.0/CC BY 4.0 -CC BY 4.0 compliance: Modified to indicate the URL. Modified size. +License: CC0 1.0 ## Forumoji diff --git a/app/__init__.py b/app/__init__.py index 7529eb4..4b6767a 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -152,7 +152,6 @@ def create_app(): @app.context_processor def inject_constants(): return { - "InfoboxIcons": InfoboxIcons, "InfoboxHTMLClass": InfoboxHTMLClass, "InfoboxKind": InfoboxKind, "PermissionLevel": PermissionLevel, diff --git a/app/constants.py b/app/constants.py index c37f972..da7c41f 100644 --- a/app/constants.py +++ b/app/constants.py @@ -56,13 +56,6 @@ class InfoboxKind(IntEnum): WARN = 2 ERROR = 3 -InfoboxIcons = { - InfoboxKind.INFO: "/static/misc/info.svg", - InfoboxKind.LOCK: "/static/misc/lock.svg", - InfoboxKind.WARN: "/static/misc/warn.svg", - InfoboxKind.ERROR: "/static/misc/error.svg", -} - InfoboxHTMLClass = { InfoboxKind.INFO: "", InfoboxKind.LOCK: "warn", diff --git a/app/templates/common/icons.html b/app/templates/common/icons.html new file mode 100644 index 0000000..47fd16c --- /dev/null +++ b/app/templates/common/icons.html @@ -0,0 +1,49 @@ +{# https://www.figma.com/community/file/1136337054881623512/iconcino-v2-0-0-free-icons-cc0-1-0-license #} + +{% macro icn_bookmark(width=24) -%} + + + +{%- endmacro %} + +{% macro icn_error(width=60) -%} + + + +{%- endmacro %} + +{% macro icn_info(width=60) -%} + + + +{%- endmacro %} + +{% macro icn_lock(width=60) -%} + + + +{%- endmacro %} + +{% macro icn_warn(width=60) -%} + + + +{%- endmacro %} + +{% macro icn_image(width=24) -%} + + + +{%- endmacro %} + +{% macro icn_spoiler(width=24) -%} + + + +{%- endmacro %} + +{% macro icn_sticky(width=24) -%} + + + +{%- endmacro %} diff --git a/app/templates/common/macros.html b/app/templates/common/macros.html index 67e68c4..ee250ff 100644 --- a/app/templates/common/macros.html +++ b/app/templates/common/macros.html @@ -1,3 +1,4 @@ +{% from 'common/icons.html' import icn_image, icn_spoiler, icn_info, icn_lock, icn_warn, icn_error %} {% macro pager(current_page, page_count) %} {% set left_start = [1, current_page - 5] | max %} {% set right_end = [page_count, current_page + 5] | min %} @@ -31,16 +32,24 @@
- + {%- if kind == InfoboxKind.INFO -%} + {{- icn_info() -}} + {%- elif kind == InfoboxKind.LOCK -%} + {{- icn_lock() -}} + {%- elif kind == InfoboxKind.WARN -%} + {{- icn_warn() -}} + {%- elif kind == InfoboxKind.ERROR -%} + {{- icn_error() -}} + {%- endif -%}
{{ message }}
{% endmacro %} -{% macro timestamp(unix_ts) %} +{% macro timestamp(unix_ts) -%} {{ unix_ts | ts_datetime('%Y-%m-%d %H:%M')}} ST -{% endmacro %} +{%- endmacro %} {% macro babycode_editor_component(ta_name, ta_placeholder="Post body", optional=False, prefill="") %}
@@ -56,10 +65,10 @@ - + - + babycode guide diff --git a/app/templates/topics/topic.html b/app/templates/topics/topic.html index e318f91..ade0155 100644 --- a/app/templates/topics/topic.html +++ b/app/templates/topics/topic.html @@ -1,4 +1,5 @@ {% from 'common/macros.html' import pager, timestamp %} +{% from 'common/icons.html' import icn_bookmark, icn_lock, icn_sticky %} {% extends "base.html" %} {% block title %}browsing topic {{ topic['name'] }}{% endblock %} {% block content %} @@ -33,7 +34,7 @@
{% if thread['is_stickied'] %} - + {{ icn_sticky() }} Stickied {% endif %}
@@ -56,7 +57,7 @@
{% if thread['is_locked'] %} - + {{ icn_lock() }} Locked {% endif %}
diff --git a/app/templates/topics/topics.html b/app/templates/topics/topics.html index 6296d3e..d42aacf 100644 --- a/app/templates/topics/topics.html +++ b/app/templates/topics/topics.html @@ -1,3 +1,4 @@ +{% from 'common/icons.html' import icn_lock %} {% from 'common/macros.html' import timestamp %} {% extends "base.html" %} {% block content %} @@ -33,7 +34,7 @@
{% if topic['is_locked'] %} - + {{ icn_lock() }} Locked {% endif %}
diff --git a/data/static/misc/error.svg b/data/static/misc/error.svg deleted file mode 100644 index 443cbf8..0000000 --- a/data/static/misc/error.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/data/static/misc/image.svg b/data/static/misc/image.svg deleted file mode 100644 index 0af5386..0000000 --- a/data/static/misc/image.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/data/static/misc/info.svg b/data/static/misc/info.svg deleted file mode 100644 index c145fb1..0000000 --- a/data/static/misc/info.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/data/static/misc/lock.svg b/data/static/misc/lock.svg deleted file mode 100644 index da003c1..0000000 --- a/data/static/misc/lock.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/data/static/misc/spoiler.svg b/data/static/misc/spoiler.svg deleted file mode 100644 index c5e81d6..0000000 --- a/data/static/misc/spoiler.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/data/static/misc/sticky.svg b/data/static/misc/sticky.svg deleted file mode 100644 index 1dba928..0000000 --- a/data/static/misc/sticky.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/data/static/misc/warn.svg b/data/static/misc/warn.svg deleted file mode 100644 index 6131242..0000000 --- a/data/static/misc/warn.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - -