Skip to content

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

DEV: Improve discovery components plugin-outlets compatibility with existing customizations

Sérgio Saquetim9919046c1c04
diff --git a/app/assets/javascripts/discourse/app/components/discovery/layout.hbs b/app/assets/javascripts/discourse/app/components/discovery/layout.hbs
index ab8d10777a4..d48ab8294c8 100644
--- a/app/assets/javascripts/discourse/app/components/discovery/layout.hbs
+++ b/app/assets/javascripts/discourse/app/components/discovery/layout.hbs
@@ -1,28 +1,37 @@
<div class="container">
<DiscourseBanner />
- {{#if @category}}
+ {{#if @model.category}}
<CategoryReadOnlyBanner
- @category={{@category}}
+ @category={{@model.category}}
@readOnly={{@createTopicDisabled}}
/>
{{/if}}
</div>
<span>
- <PluginOutlet @name="discovery-list-controls-above" @connectorTagName="div" />
+ <PluginOutlet
+ @name="discovery-list-controls-above"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
+ />
</span>
<div class="list-controls">
<PluginOutlet
@name="discovery-navigation-bar-above"
@connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
/>
<div class="container">
{{yield to="navigation"}}
</div>
</div>
-<PluginOutlet @name="discovery-above" @connectorTagName="div" />
+<PluginOutlet
+ @name="discovery-above"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
+/>
<div class="container list-container">
<div class="row">
@@ -31,26 +40,43 @@
{{yield to="header"}}
<PluginOutlet
@name="header-list-container-bottom"
- @outletArgs={{hash category=@category}}
+ @outletArgs={{hash [email protected] [email protected]}}
/>
</div>
</div>
</div>
<div class="row">
<div class="full-width">
- <PluginOutlet @name="before-list-area" />
+ <PluginOutlet
+ @name="before-list-area"
+ @outletArgs={{hash [email protected] [email protected]}}
+ />
<div id="list-area">
<PluginOutlet
- @name="discovery-list-container-top"
- @connectorTagName="span"
- @outletArgs={{hash category=@category}}
- />
- {{yield to="list"}}
+ @name="discovery-list-area"
+ @outletArgs={{hash
+ model=@model
+ }}
+ @defaultGlimmer={{true}}
+ >
+ <PluginOutlet
+ @name="discovery-list-container-top"
+ @connectorTagName="span"
+ @outletArgs={{hash [email protected] [email protected]}}
+ />
+ {{yield to="list"}}
+ </PluginOutlet>
</div>
</div>
</div>
</div>
<span>
- <PluginOutlet @name="discovery-below" @connectorTagName="div" />
+ <PluginOutlet
+ @name="discovery-below"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
+ />
</span>
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/components/discovery/navigation.hbs b/app/assets/javascripts/discourse/app/components/discovery/navigation.hbs
index b85fe2e9a9b..9535ebd0390 100644
--- a/app/assets/javascripts/discourse/app/components/discovery/navigation.hbs
+++ b/app/assets/javascripts/discourse/app/components/discovery/navigation.hbs
@@ -3,7 +3,7 @@
{{#if @category}}
<PluginOutlet
@name="above-category-heading"
- @outletArgs={{hash category=@category}}
+ @outletArgs={{hash category=@category tag=@tag}}
/>
<section class="category-heading">
@@ -18,7 +18,7 @@
<PluginOutlet
@name="category-heading"
@connectorTagName="div"
- @outletArgs={{hash category=@category}}
+ @outletArgs={{hash category=@category tag=@tag}}
/>
</span>
</section>
diff --git a/app/assets/javascripts/discourse/app/components/discovery/topics.hbs b/app/assets/javascripts/discourse/app/components/discovery/topics.hbs
index 4144978714d..4b73aab621e 100644
--- a/app/assets/javascripts/discourse/app/components/discovery/topics.hbs
+++ b/app/assets/javascripts/discourse/app/components/discovery/topics.hbs
@@ -114,46 +114,56 @@
<footer class="topic-list-bottom">
<ConditionalLoadingSpinner @condition={{@model.loadingMore}} />
{{#if this.allLoaded}}
- <TopicDismissButtons
- @position="bottom"
- @selectedTopics={{@bulkSelectHelper.selected}}
- @model={{@model}}
- @showResetNew={{@showResetNew}}
- @showDismissRead={{@showDismissRead}}
- @resetNew={{this.resetNew}}
- @dismissRead={{this.dismissRead}}
- />
-
- <FooterMessage
- @education={{this.footerEducation}}
- @message={{this.footerMessage}}
+ <PluginOutlet
+ @name="topic-list-bottom"
+ @outletArgs={{hash
+ category=@category
+ tag=@tag
+ allLoaded=this.allLoaded
+ model=@model
+ }}
>
- {{#if @tag}}
- {{html-safe
- (i18n "topic.browse_all_tags_or_latest" basePath=(base-path))
- }}
- {{else if this.latest}}
- {{#if @category.canCreateTopic}}
- <DiscourseLinkedText
- @action={{fn
- this.composer.openNewTopic
- (hash category=@category preferDraft=true)
- }}
- @text="topic.suggest_create_topic"
- />
+ <TopicDismissButtons
+ @position="bottom"
+ @selectedTopics={{@bulkSelectHelper.selected}}
+ @model={{@model}}
+ @showResetNew={{@showResetNew}}
+ @showDismissRead={{@showDismissRead}}
+ @resetNew={{this.resetNew}}
+ @dismissRead={{this.dismissRead}}
+ />
+
+ <FooterMessage
+ @education={{this.footerEducation}}
+ @message={{this.footerMessage}}
+ >
+ {{#if @tag}}
+ {{html-safe
+ (i18n "topic.browse_all_tags_or_latest" basePath=(base-path))
+ }}
+ {{else if this.latest}}
+ {{#if @category.canCreateTopic}}
+ <DiscourseLinkedText
+ @action={{fn
+ this.composer.openNewTopic
+ (hash category=@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={{@period}} @action={{@changePeriod}} />
+ {{else}}
+ {{html-safe
+ (i18n "topic.browse_all_categories_latest" basePath=(base-path))
+ }}
{{/if}}
- {{else if this.top}}
- {{html-safe
- (i18n
- "topic.browse_all_categories_latest_or_top" basePath=(base-path)
- )
- }}
- <TopPeriodButtons @period={{@period}} @action={{@changePeriod}} />
- {{else}}
- {{html-safe
- (i18n "topic.browse_all_categories_latest" basePath=(base-path))
- }}
- {{/if}}
- </FooterMessage>
+ </FooterMessage>
+ </PluginOutlet>
{{/if}}
</footer>
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/templates/discovery/categories.hbs b/app/assets/javascripts/discourse/app/templates/discovery/categories.hbs
index 5104e9c4cd6..bc77a36ffc2 100644
--- a/app/assets/javascripts/discourse/app/templates/discovery/categories.hbs
+++ b/app/assets/javascripts/discourse/app/templates/discovery/categories.hbs
@@ -1,4 +1,4 @@
-<Discovery::Layout>
+<Discovery::Layout @model={{this.model}}>
<:navigation>
<Discovery::Navigation
@showCategoryAdmin={{this.model.can_create_category}}
diff --git a/app/assets/javascripts/discourse/app/templates/discovery/filter.hbs b/app/assets/javascripts/discourse/app/templates/discovery/filter.hbs
index c65545503a3..5f1dbd4ab24 100644
--- a/app/assets/javascripts/discourse/app/templates/discovery/filter.hbs
+++ b/app/assets/javascripts/discourse/app/templates/discovery/filter.hbs
@@ -1,4 +1,4 @@
-<Discovery::Layout>
+<Discovery::Layout @model={{this.model}}>
<:navigation>
<Discovery::FilterNavigation
@queryString={{this.q}}
diff --git a/app/assets/javascripts/discourse/app/templates/discovery/list.hbs b/app/assets/javascripts/discourse/app/templates/discovery/list.hbs
index 4eb8e2655a5..4ef572b7994 100644
--- a/app/assets/javascripts/discourse/app/templates/discovery/list.hbs
+++ b/app/assets/javascripts/discourse/app/templates/discovery/list.hbs
@@ -1,5 +1,5 @@
<Discovery::Layout
- @category={{this.model.category}}
+ @model={{this.model}}
@createTopicDisabled={{this.createTopicDisabled}}
>
<:navigation>