mirror of
https://github.com/discourse/discourse.git
synced 2025-06-14 19:29:21 +08: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:
@ -4,6 +4,21 @@
|
|||||||
>
|
>
|
||||||
{{#if this.categories}}
|
{{#if this.categories}}
|
||||||
{{#if this.filteredCategories}}
|
{{#if this.filteredCategories}}
|
||||||
|
{{#if this.site.mobileView}}
|
||||||
|
<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>
|
||||||
|
{{else}}
|
||||||
<table class="category-list {{if this.showTopics 'with-topics'}}">
|
<table class="category-list {{if this.showTopics 'with-topics'}}">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -28,6 +43,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if this.mutedCategories}}
|
{{#if this.mutedCategories}}
|
||||||
<div class="muted-categories">
|
<div class="muted-categories">
|
||||||
@ -41,6 +57,21 @@
|
|||||||
{{d-icon this.mutedToggleIcon}}
|
{{d-icon this.mutedToggleIcon}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</a>
|
</a>
|
||||||
|
{{#if this.site.mobileView}}
|
||||||
|
<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>
|
||||||
|
{{else}}
|
||||||
<table
|
<table
|
||||||
class="category-list
|
class="category-list
|
||||||
{{if this.showTopics 'with-topics'}}
|
{{if this.showTopics 'with-topics'}}
|
||||||
@ -69,6 +100,7 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</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}}
|
|
Reference in New Issue
Block a user