From 71ff3417a6d86ea99a702b3e15ba7a9e5e2aaac1 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 22 Aug 2023 15:42:51 +0100 Subject: [PATCH] DEV: Remove dedicated mobile template for discovery/topics (#23179) Separate mobile templates are a pattern we're moving away from. They are not supported by Ember, and make things more difficult to develop/test. The differences between the mobile and desktop templates for `discovery/topics` are very minimal, so they can be easily integrated. The only feature missing from the main template was the new 'list header controls' UI. This commit introduces that to the main template inside an `mobileView` conditional. Key changes in behavior, many of which could be considered bug fixes, are: - Mobile will now include 'redirected reason' - Mobile will now include shared drafts - Mobile will now include before-topic-list and after-topic-list Plugin Outlets - Mobile will now have a `
` wrapper around the 'new or updated' UI, to match desktop. This does not seem to cause any visual change. Mobile-specific template overrides of `discovery/topics` will continue to function as before - this should not be a breaking change for any themes/plugins. Mobile-specific templates for the topic list and topic-list-item remain in place. --- .../app/controllers/discovery/topics.js | 8 ++ .../app/templates/discovery/topics.hbs | 10 ++ .../app/templates/mobile/discovery/topics.hbs | 120 ------------------ 3 files changed, 18 insertions(+), 120 deletions(-) delete mode 100644 app/assets/javascripts/discourse/app/templates/mobile/discovery/topics.hbs diff --git a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js b/app/assets/javascripts/discourse/app/controllers/discovery/topics.js index dcb874d7295..a87580e1f05 100644 --- a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js +++ b/app/assets/javascripts/discourse/app/controllers/discovery/topics.js @@ -204,4 +204,12 @@ export default class TopicsController extends DiscoveryController.extend( ), }); } + + get renderNewListHeaderControls() { + return ( + this.site.mobileView && + this.get("showTopicsAndRepliesToggle") && + !this.get("bulkSelectEnabled") + ); + } } diff --git a/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs b/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs index e0c14f2ad24..84d60370722 100644 --- a/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs +++ b/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs @@ -62,6 +62,16 @@
{{/if}} {{/if}} + + {{#if this.renderNewListHeaderControls}} + + {{/if}} + - - - {{#if this.top}} -
- -
- {{else}} - {{#if this.topicTrackingState.hasIncoming}} - - - - {{/if}} - {{/if}} - {{#unless this.bulkSelectEnabled}} - {{#if this.showTopicsAndRepliesToggle}} - - {{/if}} - {{/unless}} - {{#if this.hasTopics}} - - {{/if}} -
- - \ No newline at end of file