mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Remove mobile-specific template for categories-only
(#29509)
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:
parent
95cdb8224f
commit
a2fe8ed206
@ -4,29 +4,45 @@
|
|||||||
>
|
>
|
||||||
{{#if this.categories}}
|
{{#if this.categories}}
|
||||||
{{#if this.filteredCategories}}
|
{{#if this.filteredCategories}}
|
||||||
<table class="category-list {{if this.showTopics 'with-topics'}}">
|
{{#if this.site.mobileView}}
|
||||||
<thead>
|
<div class="category-list {{if this.showTopics 'with-topics'}}">
|
||||||
<tr>
|
<PluginOutlet
|
||||||
<th class="category"><span
|
@name="mobile-categories"
|
||||||
role="heading"
|
@outletArgs={{hash categories=this.filteredCategories}}
|
||||||
aria-level="2"
|
>
|
||||||
id="categories-only-category"
|
{{#each this.filteredCategories as |c|}}
|
||||||
>{{i18n "categories.category"}}</span></th>
|
<ParentCategoryRow
|
||||||
<th class="topics">{{i18n "categories.topics"}}</th>
|
@category={{c}}
|
||||||
{{#if this.showTopics}}
|
@showTopics={{this.showTopics}}
|
||||||
<th class="latest">{{i18n "categories.latest"}}</th>
|
/>
|
||||||
{{/if}}
|
{{/each}}
|
||||||
</tr>
|
</PluginOutlet>
|
||||||
</thead>
|
</div>
|
||||||
<tbody aria-labelledby="categories-only-category">
|
{{else}}
|
||||||
{{#each this.categories as |category|}}
|
<table class="category-list {{if this.showTopics 'with-topics'}}">
|
||||||
<ParentCategoryRow
|
<thead>
|
||||||
@category={{category}}
|
<tr>
|
||||||
@showTopics={{this.showTopics}}
|
<th class="category"><span
|
||||||
/>
|
role="heading"
|
||||||
{{/each}}
|
aria-level="2"
|
||||||
</tbody>
|
id="categories-only-category"
|
||||||
</table>
|
>{{i18n "categories.category"}}</span></th>
|
||||||
|
<th class="topics">{{i18n "categories.topics"}}</th>
|
||||||
|
{{#if this.showTopics}}
|
||||||
|
<th class="latest">{{i18n "categories.latest"}}</th>
|
||||||
|
{{/if}}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody aria-labelledby="categories-only-category">
|
||||||
|
{{#each this.categories as |category|}}
|
||||||
|
<ParentCategoryRow
|
||||||
|
@category={{category}}
|
||||||
|
@showTopics={{this.showTopics}}
|
||||||
|
/>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if this.mutedCategories}}
|
{{#if this.mutedCategories}}
|
||||||
@ -41,34 +57,50 @@
|
|||||||
{{d-icon this.mutedToggleIcon}}
|
{{d-icon this.mutedToggleIcon}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</a>
|
</a>
|
||||||
<table
|
{{#if this.site.mobileView}}
|
||||||
class="category-list
|
<div
|
||||||
{{if this.showTopics 'with-topics'}}
|
class="category-list
|
||||||
{{unless this.showMutedCategories 'hidden'}}"
|
{{if this.showTopics 'with-topics'}}
|
||||||
>
|
{{unless this.showMutedCategories 'hidden'}}"
|
||||||
<thead>
|
>
|
||||||
<tr>
|
{{#each this.mutedCategories as |c|}}
|
||||||
<th class="category"><span
|
|
||||||
role="heading"
|
|
||||||
aria-level="2"
|
|
||||||
id="categories-only-category-muted"
|
|
||||||
>{{i18n "categories.category"}}</span></th>
|
|
||||||
<th class="topics">{{i18n "categories.topics"}}</th>
|
|
||||||
{{#if this.showTopics}}
|
|
||||||
<th class="latest">{{i18n "categories.latest"}}</th>
|
|
||||||
{{/if}}
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody aria-labelledby="categories-only-category-muted">
|
|
||||||
{{#each this.categories as |category|}}
|
|
||||||
<ParentCategoryRow
|
<ParentCategoryRow
|
||||||
@category={{category}}
|
@category={{c}}
|
||||||
@showTopics={{this.showTopics}}
|
@showTopics={{this.showTopics}}
|
||||||
@listType="muted"
|
@listType="muted"
|
||||||
/>
|
/>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
{{else}}
|
||||||
|
<table
|
||||||
|
class="category-list
|
||||||
|
{{if this.showTopics 'with-topics'}}
|
||||||
|
{{unless this.showMutedCategories 'hidden'}}"
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="category"><span
|
||||||
|
role="heading"
|
||||||
|
aria-level="2"
|
||||||
|
id="categories-only-category-muted"
|
||||||
|
>{{i18n "categories.category"}}</span></th>
|
||||||
|
<th class="topics">{{i18n "categories.topics"}}</th>
|
||||||
|
{{#if this.showTopics}}
|
||||||
|
<th class="latest">{{i18n "categories.latest"}}</th>
|
||||||
|
{{/if}}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody aria-labelledby="categories-only-category-muted">
|
||||||
|
{{#each this.categories as |category|}}
|
||||||
|
<ParentCategoryRow
|
||||||
|
@category={{category}}
|
||||||
|
@showTopics={{this.showTopics}}
|
||||||
|
@listType="muted"
|
||||||
|
/>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
{{#if this.categories}}
|
|
||||||
{{#if this.filteredCategories}}
|
|
||||||
<div class="category-list {{if this.showTopics 'with-topics'}}">
|
|
||||||
<PluginOutlet
|
|
||||||
@name="mobile-categories"
|
|
||||||
@outletArgs={{hash categories=this.filteredCategories}}
|
|
||||||
>
|
|
||||||
{{#each this.filteredCategories as |c|}}
|
|
||||||
<ParentCategoryRow @category={{c}} @showTopics={{this.showTopics}} />
|
|
||||||
{{/each}}
|
|
||||||
</PluginOutlet>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if this.mutedCategories}}
|
|
||||||
<div class="muted-categories">
|
|
||||||
<a href class="muted-categories-link" {{on "click" this.toggleShowMuted}}>
|
|
||||||
<h3 class="muted-categories-heading">{{i18n "categories.muted"}}</h3>
|
|
||||||
{{#if this.mutedToggleIcon}}
|
|
||||||
{{d-icon this.mutedToggleIcon}}
|
|
||||||
{{/if}}
|
|
||||||
</a>
|
|
||||||
<div
|
|
||||||
class="category-list
|
|
||||||
{{if this.showTopics 'with-topics'}}
|
|
||||||
{{unless this.showMutedCategories 'hidden'}}"
|
|
||||||
>
|
|
||||||
{{#each this.mutedCategories as |c|}}
|
|
||||||
<ParentCategoryRow
|
|
||||||
@category={{c}}
|
|
||||||
@showTopics={{this.showTopics}}
|
|
||||||
@listType="muted"
|
|
||||||
/>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
Loading…
Reference in New Issue
Block a user