DEV: Indicate whether categories are missing on categories page (#27608)

This commit is contained in:
Daniel Waterworth 2024-06-25 13:15:40 -05:00 committed by GitHub
parent f3a89620a1
commit 0d6bd5207d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

@ -40,6 +40,12 @@
@listType={{this.listType}}
/>
{{/each}}
{{#if (gt this.category.unloadedSubcategoryCount 0)}}
{{i18n
"category_row.subcategory_count"
count=this.category.unloadedSubcategoryCount
}}
{{/if}}
</tbody>
</table>
{{else if this.category.subcategories}}
@ -50,6 +56,12 @@
@listType={{this.listType}}
/>
{{/each}}
{{#if (gt this.category.unloadedSubcategoryCount 0)}}
{{i18n
"category_row.subcategory_count"
count=this.category.unloadedSubcategoryCount
}}
{{/if}}
</div>
{{/if}}
</td>

View File

@ -491,6 +491,11 @@ export default class Category extends RestModel {
return this.site.categories.filterBy("parent_category_id", this.id);
}
@computed("subcategories")
get unloadedSubcategoryCount() {
return this.subcategory_count - this.subcategories.length;
}
@computed("subcategory_list")
get serializedSubcategories() {
return this.subcategory_list?.map((c) => Category.create(c));