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|}}
<table class="category-list subcategory-list with-topics">
<thead>
<tr>
<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 this.site.mobileView}}
<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>
{{else}}
<table class="category-list subcategory-list with-topics">
<thead>
<tr>
<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}}

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}}