diff options
Diffstat (limited to 'resources/vue/components/tree/TreeNodeCourseInfo.vue')
| -rw-r--r-- | resources/vue/components/tree/TreeNodeCourseInfo.vue | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/resources/vue/components/tree/TreeNodeCourseInfo.vue b/resources/vue/components/tree/TreeNodeCourseInfo.vue index 7d9f26a..2e92a09 100644 --- a/resources/vue/components/tree/TreeNodeCourseInfo.vue +++ b/resources/vue/components/tree/TreeNodeCourseInfo.vue @@ -1,5 +1,5 @@ <template> - <div class="studip-tree-child-description"> + <div v-if="node.attributes.ancestors.length > 1" class="studip-tree-child-description"> <studip-loading-skeleton v-if="isLoading" /> <div v-else> <div v-html="$ngettext( @@ -8,6 +8,13 @@ courseCount, { count: courseCount } )"></div> + <div v-if="node.attributes['has-children']" + v-html="$ngettext( + '<strong>%{count}</strong> Veranstaltung auf Unterebenen', + '<strong>%{count}</strong> Veranstaltungen auf Unterebenen', + allCourseCount, + { count: allCourseCount } + )"></div> </div> </div> </template> @@ -37,11 +44,9 @@ export default { } }, data() { - const cachedCourseInfo = this.getCachedNodeCourseInfo(this.node.id, this.semester, this.semClass); - return { - allCourseCount: cachedCourseInfo.allCourses, - courseCount: cachedCourseInfo.courses, + allCourseCount: null, + courseCount: null, showingAllCourses: false } }, @@ -57,10 +62,13 @@ export default { this.$emit('showAllCourses', state); }, loadNodeInfo(node) { - this.getNodeCourseInfo(node, this.semester, this.semClass) - .then(info => { - this.courseCount = info?.data.courses ?? 0; - }); + if (node.id) { + this.getNodeCourseInfo(node, this.semester, this.semClass) + .then(info => { + this.courseCount = info?.data.courses; + this.allCourseCount = info?.data.allcourses; + }); + } } }, watch: { |
