From 2084327a2fef2bae208214a6b68811b21cd471a3 Mon Sep 17 00:00:00 2001 From: Justin DiRose Date: Thu, 6 Feb 2020 09:41:29 -0600 Subject: [PATCH] FIX: Stop displaying empty topics message on empty search term When no topics found with a search term and the search term was cleared, the no topics error would show. This commit fixes that behavior by putting the error inside the loading component. --- .../templates/knowledge-explorer.hbs | 136 +++++++++--------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/assets/javascripts/discourse/templates/knowledge-explorer.hbs b/assets/javascripts/discourse/templates/knowledge-explorer.hbs index 5a4d250..aaa2bf9 100644 --- a/assets/javascripts/discourse/templates/knowledge-explorer.hbs +++ b/assets/javascripts/discourse/templates/knowledge-explorer.hbs @@ -3,76 +3,76 @@ searchTerm=(readonly searchTerm) onSearch=(action "performSearch") }} - {{#if emptyTopics}} - {{i18n 'knowledge_explorer.no_topics'}} - {{else}} - {{#conditional-loading-spinner condition=isLoading}} -
- {{#if site.mobileView}} - {{#unless selectedTopic}} - {{d-button class="knowledge-explorer-expander" icon=(if expandedFilters "angle-up" "angle-down") action=(action "toggleFilters") label="knowledge_explorer.filter_button"}} - {{/unless}} - {{/if}} -
- {{#if expandedFilters}} - {{#if categories}} -
-

{{i18n 'knowledge_explorer.categories'}}

- {{#each categories as |category|}} - {{knowledge-explorer-category - category=category - selectCategory=(action "updateSelectedCategories" - tagName="") - }} - {{/each}} -
- {{/if}} - {{#if tags}} -
-

{{i18n 'knowledge_explorer.tags'}}

- {{#each tags as |tag|}} - {{knowledge-explorer-tag - tag=tag - selectTag=(action "updateSelectedTags") - }} - {{/each}} -
- {{/if}} - {{/if}} -
- {{#if selectedTopic}} - {{#conditional-loading-spinner condition=isTopicLoading}} - {{knowledge-explorer-topic topic=topic}} - {{/conditional-loading-spinner}} - {{else}} -
- {{#if isSearching}} - {{#if emptySearchResults}} -
- {{i18n 'search.no_results'}} -
- {{else}} -
- {{i18n 'knowledge_explorer.search.results' - count=searchCount + {{#conditional-loading-spinner condition=isLoading}} + {{#if emptyTopics}} + {{i18n 'knowledge_explorer.no_topics'}} + {{else}} +
+ {{#if site.mobileView}} + {{#unless selectedTopic}} + {{d-button class="knowledge-explorer-expander" icon=(if expandedFilters "angle-up" "angle-down") action=(action "toggleFilters") label="knowledge_explorer.filter_button"}} + {{/unless}} + {{/if}} +
+ {{#if expandedFilters}} + {{#if categories}} +
+

{{i18n 'knowledge_explorer.categories'}}

+ {{#each categories as |category|}} + {{knowledge-explorer-category + category=category + selectCategory=(action "updateSelectedCategories" + tagName="") }} -
- {{/if}} + {{/each}} +
+ {{/if}} + {{#if tags}} +
+

{{i18n 'knowledge_explorer.tags'}}

+ {{#each tags as |tag|}} + {{knowledge-explorer-tag + tag=tag + selectTag=(action "updateSelectedTags") + }} + {{/each}} +
{{/if}} - {{#unless emptySearchResults}} - {{knowledge-explorer-topic-list - topics=topics - ascending=ascending - order=orderColumn - sortBy=(action "sortBy") - selectTopic=(action "setSelectedTopic") - loadMore=(action "loadMore") - loading=isLoadingMore - }} - {{/unless}} -
{{/if}}
- {{/conditional-loading-spinner}} - {{/if}} + {{#if selectedTopic}} + {{#conditional-loading-spinner condition=isTopicLoading}} + {{knowledge-explorer-topic topic=topic}} + {{/conditional-loading-spinner}} + {{else}} +
+ {{#if isSearching}} + {{#if emptySearchResults}} +
+ {{i18n 'search.no_results'}} +
+ {{else}} +
+ {{i18n 'knowledge_explorer.search.results' + count=searchCount + }} +
+ {{/if}} + {{/if}} + {{#unless emptySearchResults}} + {{knowledge-explorer-topic-list + topics=topics + ascending=ascending + order=orderColumn + sortBy=(action "sortBy") + selectTopic=(action "setSelectedTopic") + loadMore=(action "loadMore") + loading=isLoadingMore + }} + {{/unless}} +
+ {{/if}} +
+ {{/if}} +{{/conditional-loading-spinner}}