FIX: Empty solved filter was inescapable
When no solved topics were found in knowledge explorer, it would render an inescapable No Topics Found message. Well now there's a proper door.
This commit is contained in:
parent
6c1e565381
commit
8d1c1fee3e
|
@ -51,9 +51,10 @@ export default Ember.Controller.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@discourseComputed("topics", "isSearching")
|
||||
emptyTopics(topics, isSearching) {
|
||||
return topics.length === 0 && !isSearching ? true : false;
|
||||
@discourseComputed("topics", "isSearching", "filterSolved")
|
||||
emptyTopics(topics, isSearching, filterSolved) {
|
||||
const filtered = isSearching || filterSolved;
|
||||
return topics.length === 0 && !filtered;
|
||||
},
|
||||
|
||||
@discourseComputed("loadMoreUrl")
|
||||
|
@ -66,6 +67,11 @@ export default Ember.Controller.extend({
|
|||
return !!searchTerm;
|
||||
},
|
||||
|
||||
@discourseComputed("isSearching", "filterSolved")
|
||||
isSearchingOrFiltered(isSearching, filterSolved) {
|
||||
return isSearching || filterSolved;
|
||||
},
|
||||
|
||||
@discourseComputed("isSearching", "model")
|
||||
searchCount(isSearching, model) {
|
||||
if (isSearching) return model.search_count;
|
||||
|
@ -73,6 +79,16 @@ export default Ember.Controller.extend({
|
|||
|
||||
emptySearchResults: Ember.computed.equal("searchCount", 0),
|
||||
|
||||
@discourseComputed("topics")
|
||||
emptyFilteredResults(topics) {
|
||||
return topics.length === 0;
|
||||
},
|
||||
|
||||
@discourseComputed("emptySearchResults", "emptyFilteredResults")
|
||||
emptyResults(emptySearch, emptyFiltered) {
|
||||
return emptySearch || emptyFiltered;
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
canFilterSolved() {
|
||||
return (
|
||||
|
|
|
@ -59,8 +59,8 @@
|
|||
{{/conditional-loading-spinner}}
|
||||
{{else}}
|
||||
<div class="knowledge-explorer-results">
|
||||
{{#if isSearching}}
|
||||
{{#if emptySearchResults}}
|
||||
{{#if isSearchingOrFiltered}}
|
||||
{{#if emptyResults}}
|
||||
<div class="result-count no-result">
|
||||
{{i18n 'search.no_results'}}
|
||||
</div>
|
||||
|
@ -72,7 +72,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#unless emptySearchResults}}
|
||||
{{#unless emptyResults}}
|
||||
{{knowledge-explorer-topic-list
|
||||
topics=topics
|
||||
ascending=ascending
|
||||
|
|
Loading…
Reference in New Issue