diff --git a/kolibri/plugins/learn/assets/src/views/TopicsPage.vue b/kolibri/plugins/learn/assets/src/views/TopicsPage.vue index 3a35db8a898..c14fa7ae5c1 100644 --- a/kolibri/plugins/learn/assets/src/views/TopicsPage.vue +++ b/kolibri/plugins/learn/assets/src/views/TopicsPage.vue @@ -185,16 +185,24 @@ - + -
+ + {{ $tr('showMore') }} + +
content.kind !== ContentNodeKinds.TOPIC); - // If there are no topics, then just display all resources we have loaded. - if (!this.topics.length) { - return resources; + return this.contents.filter(content => content.kind !== ContentNodeKinds.TOPIC); + }, + resourcesDisplayed() { + // if no folders are shown at this level, show more resources to fill the space + // or if the user has explicitly requested to show more resources + if (!this.topics.length || this.showMoreResources) { + return this.resources; } - return resources.slice(0, this.childrenToDisplay); + return this.resources.slice(0, this.childrenToDisplay); + }, + moreResources() { + return this.resourcesDisplayed.length < this.resources.length; }, topics() { return this.contents.filter(content => content.kind === ContentNodeKinds.TOPIC); @@ -737,6 +752,9 @@ [topicId]: true, }; }, + handleShowMoreResources() { + this.showMoreResources = true; + }, handleLoadMoreinSubtopic(topicId) { this.subTopicLoading = topicId; this.loadMoreContents(topicId).then(() => {