DEV: Remove mobile template for subcategories-with-featured-topics (#29513)

We are moving away from the mobile-specific template pattern in favor of logical `{{#if}}` statements. This brings us closer to a standard Ember app, makes testing easier, and reduces duplicate code.
This commit is contained in:
David Taylor 2024-10-31 16:12:16 +00:00 committed by GitHub
parent 8300380287
commit 210a295a87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 41 additions and 40 deletions

View File

@ -1,24 +1,43 @@
{{#each this.categories as |category|}} {{#each this.categories as |category|}}
<table class="category-list subcategory-list with-topics"> {{#if this.site.mobileView}}
<thead> <div class="category-list subcategory-list with-topics">
<tr> <div class="parent-category">
<th class="parent-category"> <CategoryTitleLink @category={{category}} />
<CategoryTitleLink @category={{category}} /> <span class="stat" title={{category.statTitle}}>{{html-safe
<span class="stat" title={{category.statTitle}}>{{html-safe category.stat
category.stat }}</span>
}}</span> </div>
</th> <div class="subcategories">
<th class="topics">{{i18n "categories.topics"}}</th> {{#each category.serializedSubcategories as |subCategory|}}
<th class="latest">{{i18n "categories.latest"}}</th> <ParentCategoryRow @category={{subCategory}} @showTopics={{true}} />
</tr> {{else}}
</thead> {{! No subcategories... so just show the parent to avoid confusion }}
<tbody aria-labelledby="categories-only-category"> <ParentCategoryRow @category={{category}} @showTopics={{true}} />
{{#each category.serializedSubcategories as |subCategory|}} {{/each}}
<ParentCategoryRow @category={{subCategory}} @showTopics={{true}} /> </div>
{{else}} </div>
{{! No subcategories... so just show the parent to avoid confusion }} {{else}}
<ParentCategoryRow @category={{category}} @showTopics={{true}} /> <table class="category-list subcategory-list with-topics">
{{/each}} <thead>
</tbody> <tr>
</table> <th class="parent-category">
<CategoryTitleLink @category={{category}} />
<span class="stat" title={{category.statTitle}}>{{html-safe
category.stat
}}</span>
</th>
<th class="topics">{{i18n "categories.topics"}}</th>
<th class="latest">{{i18n "categories.latest"}}</th>
</tr>
</thead>
<tbody aria-labelledby="categories-only-category">
{{#each category.serializedSubcategories as |subCategory|}}
<ParentCategoryRow @category={{subCategory}} @showTopics={{true}} />
{{else}}
{{! No subcategories... so just show the parent to avoid confusion }}
<ParentCategoryRow @category={{category}} @showTopics={{true}} />
{{/each}}
</tbody>
</table>
{{/if}}
{{/each}} {{/each}}

View File

@ -1,18 +0,0 @@
{{#each this.categories as |category|}}
<div class="category-list subcategory-list with-topics">
<div class="parent-category">
<CategoryTitleLink @category={{category}} />
<span class="stat" title={{category.statTitle}}>{{html-safe
category.stat
}}</span>
</div>
<div class="subcategories">
{{#each category.serializedSubcategories as |subCategory|}}
<ParentCategoryRow @category={{subCategory}} @showTopics={{true}} />
{{else}}
{{! No subcategories... so just show the parent to avoid confusion }}
<ParentCategoryRow @category={{category}} @showTopics={{true}} />
{{/each}}
</div>
</div>
{{/each}}