UX: Show parent category name for category hashtags (#31188)

This commit changes the display of category hashtag
autocomplete to show the parent category name in this
format:

* Parent Name > Child Name

This helps further distinguish categories in the autocomplete
where there may be multiple different parent categories with
the same name child category, e.g. if every category has an
Announcements subcategory.
This commit is contained in:
Martin Brennan
2025-02-05 12:31:50 +10:00
committed by GitHub
parent f01c0c9740
commit a2dbcedbd9
3 changed files with 49 additions and 9 deletions

View File

@@ -18,7 +18,14 @@ class CategoryHashtagDataSource
def self.category_to_hashtag_item(category)
HashtagAutocompleteService::HashtagItem.new.tap do |item|
item.text = category.name
item.text =
(
if category.parent_category
"#{category.parent_category.name} > #{category.name}"
else
category.name
end
)
item.slug = category.slug
item.description = category.description_text
item.icon = icon