Skip to content

A platform for community discussion. Free, open, simple.

UX: Convert Horizon topic_card_context to boolean with theme modifier (#37325)

Régis Hanol528238399063
diff --git a/themes/horizon/about.json b/themes/horizon/about.json
index 40415f0f9eb..72b1d44254b 100644
--- a/themes/horizon/about.json
+++ b/themes/horizon/about.json
@@ -12,7 +12,11 @@
"heart",
"user-plus"
],
- "serialize_topic_is_hot": true
+ "serialize_topic_is_hot": true,
+ "serialize_topic_excerpts": {
+ "type": "setting",
+ "value": "topic_card_high_context"
+ }
},
"color_schemes": {
"Horizon": {
@@ -142,7 +146,6 @@
],
"theme_site_settings": {
"enable_welcome_banner": true,
- "search_experience": "search_field",
- "topic_card_context": "simple"
+ "search_experience": "search_field"
}
}
diff --git a/themes/horizon/javascripts/discourse/initializers/topic-list-columns.gjs b/themes/horizon/javascripts/discourse/initializers/topic-list-columns.gjs
index 2cc1a4f9390..6744d28d8ab 100644
--- a/themes/horizon/javascripts/discourse/initializers/topic-list-columns.gjs
+++ b/themes/horizon/javascripts/discourse/initializers/topic-list-columns.gjs
@@ -70,7 +70,7 @@ export default {
name: "topic-list-customizations",
initialize(container) {
- const isHighContext = settings.topic_card_context === "high_context";
+ const isHighContext = settings.topic_card_high_context;
const router = container.lookup("service:router");
function applySimpleLayout(columns) {
diff --git a/themes/horizon/locales/en.yml b/themes/horizon/locales/en.yml
index f64b4161280..a42ef5c8827 100644
--- a/themes/horizon/locales/en.yml
+++ b/themes/horizon/locales/en.yml
@@ -16,8 +16,5 @@ en:
theme_metadata:
description: "A simple, beautiful theme that improves the out of the box experience for Discourse sites."
settings:
- topic_card_context:
- description: "Amount of information displayed on topic cards. 'Simple' shows minimal info. 'High Context' includes tags, solved status, assigned users, and vote counts."
- choices:
- simple: "Simple"
- high_context: "High Context (experimental)"
+ topic_card_high_context:
+ description: "When enabled, displays additional context on topic cards including tags, excerpts, solved status, assigned users, and vote counts (experimental)"
diff --git a/themes/horizon/migrations/settings/0001-convert-topic-card-context-to-boolean.js b/themes/horizon/migrations/settings/0001-convert-topic-card-context-to-boolean.js
new file mode 100644
index 00000000000..1e1b96d25de
--- /dev/null
+++ b/themes/horizon/migrations/settings/0001-convert-topic-card-context-to-boolean.js
@@ -0,0 +1,7 @@
+export default function migrate(settings) {
+ if (settings.get("topic_card_context") === "high_context") {
+ settings.set("topic_card_high_context", true);
+ }
+ settings.delete("topic_card_context");
+ return settings;
+}
diff --git a/themes/horizon/settings.yml b/themes/horizon/settings.yml
index bbe534ec261..ad087894fb0 100644
--- a/themes/horizon/settings.yml
+++ b/themes/horizon/settings.yml
@@ -1,6 +1,3 @@
-topic_card_context:
- type: enum
- default: simple
- choices:
- - simple
- - high_context
+topic_card_high_context:
+ type: bool
+ default: false