Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove mobile-specific template for `sub-category-*` (#29512)

David Taylor83003802875f
diff --git a/app/assets/javascripts/discourse/app/components/sub-category-item.hbs b/app/assets/javascripts/discourse/app/components/sub-category-item.hbs
index dadf3b9801d..26437f539eb 100644
--- a/app/assets/javascripts/discourse/app/components/sub-category-item.hbs
+++ b/app/assets/javascripts/discourse/app/components/sub-category-item.hbs
@@ -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}}
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/components/sub-category-row.hbs b/app/assets/javascripts/discourse/app/components/sub-category-row.hbs
index 493851ff7a5..68e1f3bc83a 100644
--- a/app/assets/javascripts/discourse/app/components/sub-category-row.hbs
+++ b/app/assets/javascripts/discourse/app/components/sub-category-row.hbs
@@ -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}}
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/templates/mobile/components/sub-category-item.hbs b/app/assets/javascripts/discourse/app/templates/mobile/components/sub-category-item.hbs
deleted file mode 100644
index 907aa131c94..00000000000
--- a/app/assets/javascripts/discourse/app/templates/mobile/components/sub-category-item.hbs
+++ /dev/null
@@ -1,3 +0,0 @@
-{{#unless this.isMuted}}
- {{category-link this.category}}
-{{/unless}}
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/templates/mobile/components/sub-category-row.hbs b/app/assets/javascripts/discourse/app/templates/mobile/components/sub-category-row.hbs
deleted file mode 100644
index 09f119dd7c4..00000000000
--- a/app/assets/javascripts/discourse/app/templates/mobile/components/sub-category-row.hbs
+++ /dev/null
@@ -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}}
\ No newline at end of file