From 32607ad0584594dbdff7a352cccb5829f529cd1c Mon Sep 17 00:00:00 2001 From: justcool393 Date: Sun, 6 Nov 2022 03:44:58 -0600 Subject: [PATCH] settings: some changes and additions settings: add theme settings: move common controls to common settings: add some consts --- files/helpers/const.py | 6 ++ files/helpers/jinja2.py | 3 +- files/templates/settings_advanced.html | 4 +- files/templates/settings_common.html | 88 ++++++++++++++++ files/templates/settings_personal.html | 137 ++++++------------------- 5 files changed, 130 insertions(+), 108 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index f6963b92d..21f168ab2 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -209,6 +209,10 @@ DISCORD_CHANGELOG_CHANNEL_ID = 1034632681788538980 WPD_CHANNEL_ID = 1013990963846332456 PIN_AWARD_TEXT = " (pin award)" +THEMES = ["4chan","classic","classic_dark","coffee","dark","dramblr","light","midnight","transparent","tron","win98"] +SORTS = ["hot", "bump", "new", "old", "top", "bottom", "controversial", "comments"] +TIME_FILTERS = ["hour", "day", "week", "month", "year", "all"] + ################################################################################ ### SITE SPECIFIC CONSTANTS ################################################################################ @@ -585,6 +589,8 @@ else: # localhost or testing environment implied FEATURES['PRONOUNS'] = True FEATURES['HOUSES'] = True +HOUSES = ["None","Furry","Femboy","Vampire","Racist"] if FEATURES['HOUSES'] else ["None"] + bots = {AUTOJANNY_ID, SNAPPY_ID, LONGPOSTBOT_ID, ZOZBOT_ID, BASEDBOT_ID} COLORS = {'ff66ac','805ad5','62ca56','38a169','80ffff','2a96f3','eb4963','ff0000','f39731','30409f','3e98a7','e4432d','7b9ae4','ec72de','7f8fa6', 'f8db58','8cdbe6', DEFAULT_COLOR} diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index bf4da773d..a57f441fc 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -53,5 +53,6 @@ def inject_constants(): "CONTENT_SECURITY_POLICY_DEFAULT":CONTENT_SECURITY_POLICY_DEFAULT, "CONTENT_SECURITY_POLICY_HOME":CONTENT_SECURITY_POLICY_HOME, "TRUESCORE_DONATE_LIMIT":TRUESCORE_DONATE_LIMIT, - "BAN_EVASION_DOMAIN":BAN_EVASION_DOMAIN, "HOUSE_JOIN_COST":HOUSE_JOIN_COST, "HOUSE_SWITCH_COST":HOUSE_SWITCH_COST, "IMAGE_FORMATS":IMAGE_FORMATS + "BAN_EVASION_DOMAIN":BAN_EVASION_DOMAIN, "HOUSE_JOIN_COST":HOUSE_JOIN_COST, "HOUSE_SWITCH_COST":HOUSE_SWITCH_COST, "IMAGE_FORMATS":IMAGE_FORMATS, + "THEMES":THEMES, "SORTS":SORTS, "TIME_FILTERS":TIME_FILTERS, "HOUSES":HOUSES } diff --git a/files/templates/settings_advanced.html b/files/templates/settings_advanced.html index c335838a6..5117646f4 100644 --- a/files/templates/settings_advanced.html +++ b/files/templates/settings_advanced.html @@ -70,7 +70,7 @@

Change the default sorting for posts.

@@ -85,7 +85,7 @@

Change the default time filter for posts.

diff --git a/files/templates/settings_common.html b/files/templates/settings_common.html index dd894a1c3..1ddc1c6b6 100644 --- a/files/templates/settings_common.html +++ b/files/templates/settings_common.html @@ -14,3 +14,91 @@
{% endmacro %} + +{% macro color_section(id, form_action, form_name, section_title, current_color) %} +
+
+ +
+
+
+
+ + {% for themecolor in COLORS %} + + + {% endfor %} +
+
+

Or type a color hex code:

+
+
+ + + +
+
+
+
+{% endmacro %} + +{% macro line_text_section(id, form_action, form_name, section_title, contents, below_text, placeholder_text, button_text, show_marseys, minlength, maxlength, pattern, show_if) %} +{% if show_if -%} +
+ +
+
+ + +
+ {% if show_marseys %} +
+ {% endif %} + {{below_text}} + +
+
+
+
+{%- endif %} +{% endmacro %} + +{% macro text_area_section(id, form_action, form_name, section_title, contents, below_text, placeholder_text, show_extras, show_file_upload, maxlength, show_if) %} +{% if show_if -%} +
+ +
+
+ + + {% if show_extras %} +
+ +   + +   + {% if show_file_upload and request.headers.get('cf-ipcountry') != "T1" %} + + {% endif %} +
+ {% endif %} +
+ {{below_text}} + +
+
+
+
+{%- endif %} +{% endmacro %} diff --git a/files/templates/settings_personal.html b/files/templates/settings_personal.html index 47c7fd5f1..6ed81e232 100644 --- a/files/templates/settings_personal.html +++ b/files/templates/settings_personal.html @@ -1,93 +1,6 @@ {% extends "settings.html" %} {% block pagetitle %}Personal Settings - {{SITE_NAME}}{% endblock %} {% import 'settings_common.html' as common with context %} -{# common sections start #} -{% macro color_section(id, form_action, form_name, section_title, current_color) %} -
-
- -
-
-
-
- - {% for themecolor in COLORS %} - - - {% endfor %} -
-
-

Or type a color hex code:

-
-
- - - -
-
-
-
-{% endmacro %} -{% macro line_text_section(id, form_action, form_name, section_title, contents, below_text, placeholder_text, button_text, show_marseys, minlength, maxlength, pattern, show_if) %} -{% if show_if -%} -
- -
-
- - -
- {% if show_marseys %} -
- {% endif %} - {{below_text}} - -
-
-
-
-{%- endif %} -{% endmacro %} -{% macro text_area_section(id, form_action, form_name, section_title, contents, below_text, placeholder_text, show_extras, show_file_upload, maxlength, show_if) %} -{% if show_if -%} -
- -
-
- - - {% if show_extras %} -
- -   - -   - {% if show_file_upload and request.headers.get('cf-ipcountry') != "T1" %} - - {% endif %} -
- {% endif %} -
- {{below_text}} - -
-
-
-
-{%- endif %} -{% endmacro %} -{# common sections end #} {% block content %}