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 @@
{{ coursesCount + ' ' + $gettext('Veranstaltungen') }}
</span>
</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>
<tr class="sortable">
<th v-if="showComplete" :class="sort.by === 'completion' ? 'sort' + sort.direction.toLowerCase() : ''">
......@@ -126,11 +134,26 @@ export default {
},
currentLine: null,
open_children: [],
contentWidth: null,
};
},
created() {
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: {
...mapState('admincourses', [
'activatedFields',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment