From 83003802875f41dfdd59da87b0bb97b88887f245 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 31 Oct 2024 16:12:00 +0000 Subject: [PATCH] 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. --- .../app/components/sub-category-item.hbs | 26 +++--- .../app/components/sub-category-row.hbs | 84 ++++++++++++------- .../mobile/components/sub-category-item.hbs | 3 - .../mobile/components/sub-category-row.hbs | 23 ----- 4 files changed, 69 insertions(+), 67 deletions(-) delete mode 100644 app/assets/javascripts/discourse/app/templates/mobile/components/sub-category-item.hbs delete mode 100644 app/assets/javascripts/discourse/app/templates/mobile/components/sub-category-row.hbs 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}} - - - {{category-link this.category hideParent="true"}} - {{#unless this.hideUnread}} - - {{/unless}} - + {{#if this.site.mobileView}} + {{category-link this.category}} + {{else}} + + + {{category-link this.category hideParent="true"}} + {{#unless this.hideUnread}} + + {{/unless}} + + {{/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}} - - - - {{#if this.category.description_excerpt}} -
- {{dir-span this.category.description_excerpt htmlSafe="true"}} + + +
+ {{#if this.category.subcategories}} +
+ {{#each this.category.subcategories as |subcategory|}} + + {{/each}} +
+ {{/if}}
- {{/if}} - {{#if this.category.subcategories}} -
- {{#each this.category.subcategories as |subsubcategory|}} - - {{/each}} -
- {{/if}} - - + + + {{else}} + + + + {{#if this.category.description_excerpt}} +
+ {{dir-span this.category.description_excerpt htmlSafe="true"}} +
+ {{/if}} + {{#if this.category.subcategories}} +
+ {{#each this.category.subcategories as |subsubcategory|}} + + {{/each}} +
+ {{/if}} + + + {{/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}} - - - -
- {{#if this.category.subcategories}} -
- {{#each this.category.subcategories as |subcategory|}} - - {{/each}} -
- {{/if}} -
- - -{{/unless}} \ No newline at end of file