Skip to content
Snippets Groups Projects
Commit 9ba5fa0f authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

admin courses: provide width hint in col group for contents column, fixes #3078

Closes #3078

Merge request studip/studip!3248
parent 9ebafb47
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,14 @@ ...@@ -9,6 +9,14 @@
{{ coursesCount + ' ' + $gettext('Veranstaltungen') }} {{ coursesCount + ' ' + $gettext('Veranstaltungen') }}
</span> </span>
</caption> </caption>
<colgroup>
<col v-if="showComplete">
<col v-for="activeField in sortedActivatedFields"
:key="`col-${activeField}`"
:style="{width: activeField === 'contents' && contentWidth !== null ? `${contentWidth}px` : null}"
>
<col>
</colgroup>
<thead> <thead>
<tr class="sortable"> <tr class="sortable">
<th v-if="showComplete" :class="sort.by === 'completion' ? 'sort' + sort.direction.toLowerCase() : ''"> <th v-if="showComplete" :class="sort.by === 'completion' ? 'sort' + sort.direction.toLowerCase() : ''">
...@@ -126,11 +134,26 @@ export default { ...@@ -126,11 +134,26 @@ export default {
}, },
currentLine: null, currentLine: null,
open_children: [], open_children: [],
contentWidth: null,
}; };
}, },
created() { created() {
this.loadCourses(); this.loadCourses();
}, },
updated() {
const iconNavigations = this.$el.querySelectorAll('tbody .my-courses-navigation');
if (iconNavigations.length === 0) {
this.contentWidth = null;
return;
}
const iconCounts = Array.from(iconNavigations).map(node => {
return node.querySelectorAll('.my-courses-navigation-item').length;
});
this.contentWidth = Math.max(...iconCounts) * 26;
},
computed: { computed: {
...mapState('admincourses', [ ...mapState('admincourses', [
'activatedFields', 'activatedFields',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment