DEV: Remove mobile-specific template for `sub-category-*` (#29512)
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
8bb360d849
commit
8300380287
|
@ -1,13 +1,17 @@
|
|||
{{#unless this.isMuted}}
|
||||
<span class="subcategory">
|
||||
<CategoryTitleBefore @category={{this.category}} />
|
||||
{{category-link this.category hideParent="true"}}
|
||||
{{#unless this.hideUnread}}
|
||||
<CategoryUnread
|
||||
@category={{this.category}}
|
||||
@unreadTopicsCount={{this.unreadTopicsCount}}
|
||||
@newTopicsCount={{this.newTopicsCount}}
|
||||
/>
|
||||
{{/unless}}
|
||||
</span>
|
||||
{{#if this.site.mobileView}}
|
||||
{{category-link this.category}}
|
||||
{{else}}
|
||||
<span class="subcategory">
|
||||
<CategoryTitleBefore @category={{this.category}} />
|
||||
{{category-link this.category hideParent="true"}}
|
||||
{{#unless this.hideUnread}}
|
||||
<CategoryUnread
|
||||
@category={{this.category}}
|
||||
@unreadTopicsCount={{this.unreadTopicsCount}}
|
||||
@newTopicsCount={{this.newTopicsCount}}
|
||||
/>
|
||||
{{/unless}}
|
||||
</span>
|
||||
{{/if}}
|
||||
{{/unless}}
|
|
@ -1,35 +1,59 @@
|
|||
{{#unless this.isHidden}}
|
||||
<tr
|
||||
data-category-id={{this.category.id}}
|
||||
data-notification-level={{this.category.notificationLevelString}}
|
||||
class="{{if
|
||||
this.category.description_excerpt
|
||||
'has-description'
|
||||
'no-description'
|
||||
}}
|
||||
{{if this.category.uploaded_logo.url 'has-logo' 'no-logo'}}"
|
||||
>
|
||||
<td
|
||||
class="category {{if this.isMuted 'muted'}}"
|
||||
{{#if this.site.mobileView}}
|
||||
<tr
|
||||
data-category-id={{this.category.id}}
|
||||
style={{border-color this.category.color}}
|
||||
class="subcategory-list-item category {{if this.isMuted 'muted'}}"
|
||||
>
|
||||
<CategoryTitleLink @tagName="h4" @category={{this.category}} />
|
||||
{{#if this.category.description_excerpt}}
|
||||
<div class="category-description subcategory-description">
|
||||
{{dir-span this.category.description_excerpt htmlSafe="true"}}
|
||||
<td>
|
||||
<CategoryTitleLink @tagName="h4" @category={{this.category}} />
|
||||
<div class="subcategories-list">
|
||||
{{#if this.category.subcategories}}
|
||||
<div class="subcategories">
|
||||
{{#each this.category.subcategories as |subcategory|}}
|
||||
<SubCategoryItem
|
||||
@category={{subcategory}}
|
||||
@listType={{this.listType}}
|
||||
/>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if this.category.subcategories}}
|
||||
<div class="subcategories">
|
||||
{{#each this.category.subcategories as |subsubcategory|}}
|
||||
<SubCategoryItem
|
||||
@category={{subsubcategory}}
|
||||
@hideUnread="true"
|
||||
@listType={{this.listType}}
|
||||
/>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr
|
||||
data-category-id={{this.category.id}}
|
||||
data-notification-level={{this.category.notificationLevelString}}
|
||||
class="{{if
|
||||
this.category.description_excerpt
|
||||
'has-description'
|
||||
'no-description'
|
||||
}}
|
||||
{{if this.category.uploaded_logo.url 'has-logo' 'no-logo'}}"
|
||||
>
|
||||
<td
|
||||
class="category {{if this.isMuted 'muted'}}"
|
||||
style={{border-color this.category.color}}
|
||||
>
|
||||
<CategoryTitleLink @tagName="h4" @category={{this.category}} />
|
||||
{{#if this.category.description_excerpt}}
|
||||
<div class="category-description subcategory-description">
|
||||
{{dir-span this.category.description_excerpt htmlSafe="true"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if this.category.subcategories}}
|
||||
<div class="subcategories">
|
||||
{{#each this.category.subcategories as |subsubcategory|}}
|
||||
<SubCategoryItem
|
||||
@category={{subsubcategory}}
|
||||
@hideUnread="true"
|
||||
@listType={{this.listType}}
|
||||
/>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{/unless}}
|
|
@ -1,3 +0,0 @@
|
|||
{{#unless this.isMuted}}
|
||||
{{category-link this.category}}
|
||||
{{/unless}}
|
|
@ -1,23 +0,0 @@
|
|||
{{#unless this.isHidden}}
|
||||
<tr
|
||||
data-category-id={{this.category.id}}
|
||||
style={{border-color this.category.color}}
|
||||
class="subcategory-list-item category {{if this.isMuted 'muted'}}"
|
||||
>
|
||||
<td>
|
||||
<CategoryTitleLink @tagName="h4" @category={{this.category}} />
|
||||
<div class="subcategories-list">
|
||||
{{#if this.category.subcategories}}
|
||||
<div class="subcategories">
|
||||
{{#each this.category.subcategories as |subcategory|}}
|
||||
<SubCategoryItem
|
||||
@category={{subcategory}}
|
||||
@listType={{this.listType}}
|
||||
/>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{/unless}}
|
Loading…
Reference in New Issue