mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user