Skip to content

Commit

Permalink
Add category info in moderation ticket view
Browse files Browse the repository at this point in the history
  • Loading branch information
ffont committed Jan 21, 2025
1 parent a3ead98 commit 3e66de0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions sounds/templatetags/bst_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def bst_taxonomy_category_key_to_category_names(category_key):
This includes both the top level and the sub level category names.
E.g.: "m-sp" -> ("Music", "Solo percussion"), "m" -> ("Music", None)
"""
if category_key is None:
return (None, None)
if '-' in category_key:
# Sub level category key
top_level_key = category_key.split('-')[0]
Expand Down
2 changes: 1 addition & 1 deletion templates/molecules/bst_category_form_field.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div class="v-spacing-top-2 line-height-50">
{% for value, label in form.fields.bst_category.choices %}
{% if "-" in value %}
<button type="button" class="btn no-hover {% if value == form.bst_category.value %}btn-primary{% else %}btn-inverse{% endif %} btn-subcategory tooltip_top" top_level="{{ value|get_top_level_bst_category }}" data_value="{{ value }}">
<button type="button" class="btn no-hover {% if value == form.bst_category.value %}btn-primary{% else %}btn-inverse{% endif %} btn-subcategory tooltip_top" top_level="{{ value|get_bst_taxonomy_top_level_category_key }}" data_value="{{ value }}">
{{ label }}
{% for item in bst_taxonomy %}
{% if item.key == value %}
Expand Down
10 changes: 9 additions & 1 deletion templates/sounds/display_sound.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ <h5 class="ellipsis">
{% for tag in sound.tag_array%}
{% bw_tag tag %}
{% endfor %}
<div class="v-spacing-top-1" title="{{ sound.description|striptags|safe|force_escape }}">
{% with sound.get_category_names as cat_names %}
{% if cat_names.0 is not None %}
<div class="ellipsis text-grey v-spacing-top-1">
{% bw_icon 'box-add' %}
{{ cat_names.0 }}{% if cat_names.1 %} > {{ cat_names.1}}{% endif %}
</div>
{% endif %}
{% endwith %}
<div class="" title="{{ sound.description|striptags|safe|force_escape }}">
{{ sound.description|safe|linebreaks }}
</div>
</div>
Expand Down

0 comments on commit 3e66de0

Please sign in to comment.