From 7125dd7cfe266f615ac43dc63bf70e21a89af51f Mon Sep 17 00:00:00 2001 From: cube Date: Fri, 20 Mar 2026 23:13:52 +0000 Subject: [PATCH] themes properly implemented #1 - requires db init --- README.md | 1 + myriad/manage.py | 7 ++- myriad/schema.sql | 15 +------ myriad/static/themes/default.css | 40 +++++++++++++++++ myriad/static/themes/purple.css | 44 +++++++++++++++++++ myriad/templates/auth/login.html | 4 ++ myriad/templates/auth/register.html | 4 ++ myriad/templates/base.html | 11 ++--- myriad/templates/blog/blog.html | 10 ++++- myriad/templates/blog/edit.html | 3 ++ myriad/templates/blog/new.html | 4 +- myriad/templates/full.html | 51 +++++----------------- myriad/templates/groups.html | 6 +++ myriad/templates/index.html | 48 ++++----------------- myriad/templates/manage/assets.html | 2 + myriad/templates/manage/edit.html | 67 ++++++----------------------- myriad/templates/manage/groups.html | 2 + myriad/templates/manage/new.html | 3 +- myriad/templates/page.html | 47 +++----------------- 19 files changed, 167 insertions(+), 202 deletions(-) create mode 100644 myriad/static/themes/default.css create mode 100644 myriad/static/themes/purple.css diff --git a/README.md b/README.md index 6ba2787..7c9d7d4 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ BLINKIES_UPLOAD_FOLDER = 'myriad/static/blinkies' # where site assets "blinkies" STAMPS_UPLOAD_FOLDER = 'myriad/static/stamps' # where site assets "stamps" will be stored INLINE_UPLOAD_FOLDER = 'myriad/static/inline' # where site assets "misc inline" will be stored MISC_UPLOAD_FOLDER = 'myriad/static/misc' # where other small images will be stored +THEMES_FOLDER = 'myriad/static/themes' # where theme choices will be stored ``` # usage diff --git a/myriad/manage.py b/myriad/manage.py index 9d53d0e..9cce7a7 100644 --- a/myriad/manage.py +++ b/myriad/manage.py @@ -44,8 +44,9 @@ def edit(mid): name = request.form['name'] bio = request.form['bio'] subtitle = request.form['subtitle'] + theme = request.form["theme"] privacy = request.form["privacy"] - db.execute("UPDATE member SET member_name=(?), bio=(?), subtitle=(?), public=(?) WHERE id=(?)",(name, bio, subtitle, privacy, mid)) + db.execute("UPDATE member SET member_name=(?), bio=(?), subtitle=(?), public=(?), theme=(?) WHERE id=(?)",(name, bio, subtitle, privacy, theme, mid)) db.commit() if "file" in request.files: @@ -106,7 +107,9 @@ def edit(mid): else: unjoined_groups.append(group) - return render_template("manage/edit.html", member=member, icons=icons, unjoined_groups=unjoined_groups, joined_groups=joined_groups) + themes = os.listdir(current_app.config["THEMES_FOLDER"]) + + return render_template("manage/edit.html", member=member, icons=icons, unjoined_groups=unjoined_groups, joined_groups=joined_groups, themes=themes) @bp.route("/set_main_icon//") @login_required diff --git a/myriad/schema.sql b/myriad/schema.sql index 370e93e..a958978 100644 --- a/myriad/schema.sql +++ b/myriad/schema.sql @@ -21,21 +21,8 @@ CREATE TABLE member ( main_icon INTEGER, homepage BOOLEAN NOT NULL DEFAULT 0, front BOOLEAN NOT NULL DEFAULT 0, - card_border TEXT NOT NULL DEFAULT '#99dfff', - card_bg TEXT NOT NULL DEFAULT '#e6f7ff', - heading_bg TEXT NOT NULL DEFAULT '#b3e7ff', - heading_border TEXT NOT NULL DEFAULT '#008bcc', - heading_name TEXT NOT NULL DEFAULT 'black', - heading_subtitle TEXT NOT NULL DEFAULT 'black', - card_text TEXT NOT NULL DEFAULT 'black', - icon_border TEXT NOT NULL DEFAULT '#008bcc', - page_bg TEXT NOT NULL DEFAULT '#00b7ff', - gradient1 TEXT NOT NULL DEFAULT '#00b7ff', - gradient2 TEXT NOT NULL DEFAULT '#57c785', - gradient3 TEXT NOT NULL DEFAULT '#eddd53', - a1 TEXT NOT NULL DEFAULT '#008bcc', - a2 TEXT NOT NULL DEFAULT '#026897', public BOOLEAN NOT NULL DEFAULT 1, + theme TEXT NOT NULL DEFAULT 'default', FOREIGN KEY (user_id) REFERENCES user (id), FOREIGN KEY (main_icon) REFERENCES icons (id) ); diff --git a/myriad/static/themes/default.css b/myriad/static/themes/default.css new file mode 100644 index 0000000..60adbbf --- /dev/null +++ b/myriad/static/themes/default.css @@ -0,0 +1,40 @@ +.default{ + background-color:#e6f7ff; + border-color:#99dfff; + color:black; +} +.default .heading +{ + background-color:#b3e7ff; + border-color:#008bcc; + color:black; +} +.default .heading b +{ + color:black; +} +.default a{ + color: #008bcc; +} +.default a:hover{ + color: #026897; +} +.default ::selection { + background: #008bcc; + color: white; + text-shadow: none; +} +.default ::-moz-selection { + background: #008bcc; + color: #EEE; + text-shadow: none; +} +.default .icon{ + border-color:#008bcc; +} + +.default body{ + background: #00b7ff; + background: linear-gradient(90deg, #00b7ff 0%, #57c785 50%, #eddd53 100%); + scrollbar-color:#008bcc #b3e7ff; +} \ No newline at end of file diff --git a/myriad/static/themes/purple.css b/myriad/static/themes/purple.css new file mode 100644 index 0000000..99f69b8 --- /dev/null +++ b/myriad/static/themes/purple.css @@ -0,0 +1,44 @@ +.purple{ + background-color:#ecc9fa; + border-color:#a414da; + color:black; +} +.purple .heading +{ + background-color:#d991f4; + border-color:#a414da; + color:black; +} +.purple .heading b +{ + color:black; +} +.purple a{ + color: #a414da; +} +.purple a:hover{ + color: #720e98; +} +.purple ::selection { + background:#a414da; + color: white; + text-shadow: none; +} +.purple ::-moz-selection { + background: #a414da; + color: #EEE; + text-shadow: none; +} +.purple .icon{ + border-color:#a414da; +} + +body.purple{ + background: #fb46c0; + background: linear-gradient(90deg, #fb46c0 0%, #a414da 50%, #720e98 100%); + scrollbar-color:#a414da #d991f4; +} +.purple .container{ + background-color:#ecc9fa; + border-color:#a414da; +} \ No newline at end of file diff --git a/myriad/templates/auth/login.html b/myriad/templates/auth/login.html index fcd2cc7..aeb63cd 100644 --- a/myriad/templates/auth/login.html +++ b/myriad/templates/auth/login.html @@ -5,6 +5,8 @@ {% endblock %} {% block content %} +
+

@@ -12,4 +14,6 @@
+ +
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/auth/register.html b/myriad/templates/auth/register.html index 9ee1ea2..e962a41 100644 --- a/myriad/templates/auth/register.html +++ b/myriad/templates/auth/register.html @@ -5,6 +5,8 @@ {% endblock %} {% block content %} +
+

@@ -12,4 +14,6 @@
+ +
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/base.html b/myriad/templates/base.html index 2f48c58..79c46d3 100644 --- a/myriad/templates/base.html +++ b/myriad/templates/base.html @@ -3,6 +3,9 @@ {% block title %}{% endblock %} - Myriad + + +
@@ -40,13 +43,7 @@
-
- - {% block header %}{% endblock %} - {% for message in get_flashed_messages() %} -
{{ message }}
- {% endfor %} + {% block content %}{% endblock %} -
\ No newline at end of file diff --git a/myriad/templates/blog/blog.html b/myriad/templates/blog/blog.html index e3fbbae..0c2ba7d 100644 --- a/myriad/templates/blog/blog.html +++ b/myriad/templates/blog/blog.html @@ -5,10 +5,11 @@ {% endblock %} {% block content %} +
{% for post in blog %} {% set op = member_ids[post[1]] %} - {% if not g.user and op[23]==0 %} + {% if not g.user and op[9]==0 %} {% elif not g.user and post[5]==0 %} {% else %}
@@ -18,7 +19,7 @@ {% endif %}
{{post[3]|safe}}
-
{{post[2]}} - {{op[3]}} {% if g.user %}{% if op[23]==0 %}(Private){% else %}(Public){% endif %}{% endif %}
+
{{post[2]}} - {{op[3]}} {% if g.user %}{% if op[9]==0 %}(Private){% else %}(Public){% endif %}{% endif %}
{{post[4]|safe}}
@@ -30,4 +31,9 @@ {% endif %} {% endfor %} + {% if not blog %} +

There are currently no posts to view

+ {% endif %} + +
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/blog/edit.html b/myriad/templates/blog/edit.html index 4c56cd5..5f7170e 100644 --- a/myriad/templates/blog/edit.html +++ b/myriad/templates/blog/edit.html @@ -5,6 +5,8 @@ {% endblock %} {% block content %} +
+

@@ -24,4 +26,5 @@
+
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/blog/new.html b/myriad/templates/blog/new.html index 60f11a6..289ebba 100644 --- a/myriad/templates/blog/new.html +++ b/myriad/templates/blog/new.html @@ -5,6 +5,8 @@ {% endblock %} {% block content %} +
+

@@ -24,6 +26,6 @@
- {{ error }} +
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/full.html b/myriad/templates/full.html index e26c3e6..bba3fb9 100644 --- a/myriad/templates/full.html +++ b/myriad/templates/full.html @@ -5,60 +5,26 @@ {% endblock %} {% block content %} +
+ {% if memberlist %}
jump to:
{% for member in memberlist %} - {% if not g.user and member[23]==0 %} + {% if not g.user and member[9]==0 %} {% else %} {{ member[3] }} | {% endif %} {% endfor %}
+ {% endif %} {% for member in memberlist %} - - - {% if not g.user and member[23]==0 %} + {% if not g.user and member[9]==0 %} {% else %} -
+
{{ member[3]|safe }} {{ member[4]|safe }}
{% if icons[member[0]] %} @@ -77,4 +43,9 @@ {% endfor %} + {% if not memberlist %} +

There are currently no members to view

+ {% endif %} + +
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/groups.html b/myriad/templates/groups.html index 84eb323..b86bcb8 100644 --- a/myriad/templates/groups.html +++ b/myriad/templates/groups.html @@ -2,6 +2,7 @@ {% block title %}Groups{% endblock %} {% block content %} +
{% for group in groups %} {% if not g.user and group[3]==0 %} @@ -18,4 +19,9 @@ {% endif %} {% endfor %} + {% if not groups %} +

There are currently no groups to view

+ {% endif %} + +
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/index.html b/myriad/templates/index.html index ca3aaf9..58e9fe9 100644 --- a/myriad/templates/index.html +++ b/myriad/templates/index.html @@ -2,57 +2,23 @@ {% block title %}Welcome{% endblock %} {% block content %} +
{% if front_list|length > 0 %}
currently fronting: {% for member in front_list %} {{ member[3] }} {% if front_list.index(member) != front_list|length -1 %}&{% endif %} {% endfor %}
+ {% else %} +

There are currently no members listed as fronting

{% endif %} {% for member in home_pins %} - {% if not g.user and member[23]==0 %} + {% if not g.user and member[9]==0 %} {% else %} - - -
+
{{ member[3]|safe }} {{ member[4]|safe }}
{% if icons[member[0]] %} @@ -71,5 +37,9 @@ {% endif %} {% endfor %} + {% if not home_pins %} +

There are currently no members pinned to the homepage.

+ {% endif %} +
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/manage/assets.html b/myriad/templates/manage/assets.html index 2a7ded0..76e7d0a 100644 --- a/myriad/templates/manage/assets.html +++ b/myriad/templates/manage/assets.html @@ -5,6 +5,7 @@ {% endblock %} {% block content %} +
Icons
@@ -38,4 +39,5 @@
Stamps
+
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/manage/edit.html b/myriad/templates/manage/edit.html index 74a771c..92f42b2 100644 --- a/myriad/templates/manage/edit.html +++ b/myriad/templates/manage/edit.html @@ -5,6 +5,8 @@ {% endblock %} {% block content %} +
+ View {{member[3]}}'s page
@@ -17,10 +19,17 @@
-
- +

+ +

+
- +
@@ -66,55 +75,5 @@ {% endfor %}
-
Manage Theme
- -
- -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- -
- - -
- - -
- - -
- - -
- - Click here to reset member theme to default - - {{ error }} - +
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/manage/groups.html b/myriad/templates/manage/groups.html index 5b7c774..6121da2 100644 --- a/myriad/templates/manage/groups.html +++ b/myriad/templates/manage/groups.html @@ -5,6 +5,7 @@ {% endblock %} {% block content %} +
Create new group
@@ -34,4 +35,5 @@
{% endfor %} +
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/manage/new.html b/myriad/templates/manage/new.html index 89b37e2..7dbf909 100644 --- a/myriad/templates/manage/new.html +++ b/myriad/templates/manage/new.html @@ -5,6 +5,7 @@ {% endblock %} {% block content %} +

@@ -13,6 +14,6 @@ - {{ error }} +
{% endblock %} \ No newline at end of file diff --git a/myriad/templates/page.html b/myriad/templates/page.html index e892ebd..ff1eda7 100644 --- a/myriad/templates/page.html +++ b/myriad/templates/page.html @@ -1,52 +1,13 @@ {% extends 'base.html' %} {% block title %}{{ member[3] }}{% endblock %} - - {% block content %} + - +
- - {% if not g.user and member[23]==0 %} + {% if not g.user and member[9]==0 %} permission denied {% else %} @@ -95,4 +56,6 @@ {% endif %} +
+ {% endblock %} \ No newline at end of file