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 `<div class="show-more">` 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.
This commit is contained in:
parent
fd8fdb060f
commit
71ff3417a6
|
@ -204,4 +204,12 @@ export default class TopicsController extends DiscoveryController.extend(
|
|||
),
|
||||
});
|
||||
}
|
||||
|
||||
get renderNewListHeaderControls() {
|
||||
return (
|
||||
this.site.mobileView &&
|
||||
this.get("showTopicsAndRepliesToggle") &&
|
||||
!this.get("bulkSelectEnabled")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,16 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if this.renderNewListHeaderControls}}
|
||||
<NewListHeaderControlsWrapper
|
||||
@current={{this.model.params.subset}}
|
||||
@newRepliesCount={{this.newRepliesCount}}
|
||||
@newTopicsCount={{this.newTopicsCount}}
|
||||
@changeNewListSubset={{route-action "changeNewListSubset"}}
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
<span>
|
||||
<PluginOutlet
|
||||
@name="before-topic-list"
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
{{#if (or this.loading this.model.canLoadMore)}}
|
||||
{{hide-application-footer}}
|
||||
{{/if}}
|
||||
|
||||
<TopicDismissButtons
|
||||
@position="top"
|
||||
@selectedTopics={{this.selected}}
|
||||
@model={{this.model}}
|
||||
@showResetNew={{this.showResetNew}}
|
||||
@showDismissRead={{this.showDismissRead}}
|
||||
@resetNew={{action "resetNew"}}
|
||||
/>
|
||||
|
||||
<DiscoveryTopicsList
|
||||
@model={{this.model}}
|
||||
@refresh={{action "refresh"}}
|
||||
@incomingCount={{this.topicTrackingState.incomingCount}}
|
||||
>
|
||||
{{#if this.top}}
|
||||
<div class="top-lists">
|
||||
<PeriodChooser
|
||||
@period={{this.period}}
|
||||
@action={{action "changePeriod"}}
|
||||
@fullDay={{false}}
|
||||
/>
|
||||
</div>
|
||||
{{else}}
|
||||
{{#if this.topicTrackingState.hasIncoming}}
|
||||
<a
|
||||
href
|
||||
{{on "click" this.showInserted}}
|
||||
class="alert alert-info clickable"
|
||||
>
|
||||
<CountI18n
|
||||
@key="topic_count_"
|
||||
@suffix={{this.topicTrackingState.filter}}
|
||||
@count={{this.topicTrackingState.incomingCount}}
|
||||
/>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#unless this.bulkSelectEnabled}}
|
||||
{{#if this.showTopicsAndRepliesToggle}}
|
||||
<NewListHeaderControlsWrapper
|
||||
@current={{this.model.params.subset}}
|
||||
@newRepliesCount={{this.newRepliesCount}}
|
||||
@newTopicsCount={{this.newTopicsCount}}
|
||||
@changeNewListSubset={{route-action "changeNewListSubset"}}
|
||||
/>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
{{#if this.hasTopics}}
|
||||
<TopicList
|
||||
@ascending={{this.ascending}}
|
||||
@highlightLastVisited={{true}}
|
||||
@showPosters={{true}}
|
||||
@canBulkSelect={{this.canBulkSelect}}
|
||||
@toggleBulkSelect={{action "toggleBulkSelect"}}
|
||||
@updateAutoAddTopicsToBulkSelect={{action
|
||||
"updateAutoAddTopicsToBulkSelect"
|
||||
}}
|
||||
@hideCategory={{this.model.hideCategory}}
|
||||
@order={{this.order}}
|
||||
@bulkSelectEnabled={{this.bulkSelectEnabled}}
|
||||
@bulkSelectAction={{action "refresh"}}
|
||||
@selected={{this.selected}}
|
||||
@expandGloballyPinned={{this.expandGloballyPinned}}
|
||||
@expandAllPinned={{this.expandAllPinned}}
|
||||
@category={{this.category}}
|
||||
@topics={{this.model.topics}}
|
||||
/>
|
||||
{{/if}}
|
||||
</DiscoveryTopicsList>
|
||||
|
||||
<footer class="topic-list-bottom">
|
||||
<ConditionalLoadingSpinner @condition={{this.model.loadingMore}} />
|
||||
{{#if this.allLoaded}}
|
||||
<TopicDismissButtons
|
||||
@position="bottom"
|
||||
@selectedTopics={{this.selected}}
|
||||
@model={{this.model}}
|
||||
@showResetNew={{this.showResetNew}}
|
||||
@showDismissRead={{this.showDismissRead}}
|
||||
@resetNew={{action "resetNew"}}
|
||||
/>
|
||||
|
||||
<FooterMessage
|
||||
@education={{this.footerEducation}}
|
||||
@message={{this.footerMessage}}
|
||||
>
|
||||
{{#if this.latest}}
|
||||
{{#if this.category.canCreateTopic}}
|
||||
<DiscourseLinkedText
|
||||
@action={{fn
|
||||
this.composer.openNewTopic
|
||||
(hash category=this.category preferDraft=true)
|
||||
}}
|
||||
@text="topic.suggest_create_topic"
|
||||
/>
|
||||
{{/if}}
|
||||
{{else if this.top}}
|
||||
{{html-safe
|
||||
(i18n
|
||||
"topic.browse_all_categories_latest_or_top" basePath=(base-path)
|
||||
)
|
||||
}}
|
||||
<TopPeriodButtons
|
||||
@period={{this.period}}
|
||||
@action={{action "changePeriod"}}
|
||||
/>
|
||||
{{else}}
|
||||
{{html-safe
|
||||
(i18n "topic.browse_all_categories_latest" basePath=(base-path))
|
||||
}}
|
||||
{{/if}}
|
||||
</FooterMessage>
|
||||
{{else}}
|
||||
{{hide-application-footer}}
|
||||
{{/if}}
|
||||
</footer>
|
Loading…
Reference in New Issue