Skip to content
Snippets Groups Projects
Commit 6428892f authored by Ron Lucke's avatar Ron Lucke Committed by David Siegfried
Browse files

fix #3918

Closes #3918

Merge request studip/studip!2776
parent fe1aecd5
No related branches found
No related tags found
No related merge requests found
...@@ -16,21 +16,21 @@ ...@@ -16,21 +16,21 @@
</div> </div>
<div v-else class="cw-root-content-wrapper"> <div v-else class="cw-root-content-wrapper">
<div class="cw-root-content" :class="['cw-root-content-' + rootLayout]"> <div class="cw-root-content" :class="['cw-root-content-' + rootLayout]">
<div class="cw-root-content-img" :style="image"> <div class="cw-root-content-img" :style="bgImage">
<section class="cw-root-content-description" :style="bgColor"> <section class="cw-root-content-description" :style="bgColor">
<img v-if="imageIsSet" class="cw-root-content-description-img" :src="imageURL" /> <div class="cw-root-content-description-img" :src="imageURL" :style="image"></div>
<template v-else> <template v-if="!imageIsSet">
<studip-ident-image <studip-ident-image
class="cw-root-content-description-img" class="cw-root-content-description-img"
v-model="identImageCanvas" v-model="identImage"
:showCanvas="true"
:baseColor="bgColorHex" :baseColor="bgColorHex"
:pattern="structuralElement.attributes.title" :pattern="structuralElement.attributes.title"
/> />
<studip-ident-image <studip-ident-image
v-model="identImage" v-model="identBgImage"
:width="1095" class="cw-root-content-description-background-img"
:height="withTOC ? 300 : 480" :width="4380"
:height="withTOC ? 1200 : 1920"
:baseColor="bgColorHex" :baseColor="bgColorHex"
:pattern="structuralElement.attributes.title" :pattern="structuralElement.attributes.title"
/> />
...@@ -46,44 +46,28 @@ ...@@ -46,44 +46,28 @@
</div> </div>
<div v-if="withTOC" class="cw-root-content-toc"> <div v-if="withTOC" class="cw-root-content-toc">
<ul class="cw-tiles"> <ul class="cw-tiles">
<li <li v-for="child in childElements" :key="child.id">
v-for="child in childElements"
:key="child.id"
class="tile"
:class="[child.attributes.payload.color]"
>
<router-link :to="'/structural_element/' + child.id" :title="child.attributes.title"> <router-link :to="'/structural_element/' + child.id" :title="child.attributes.title">
<div <courseware-tile
v-if="hasImage(child)" tag="div"
class="preview-image" :color="child.attributes.payload.color"
:style="getChildStyle(child)" :title="child.attributes.title || '–'"
></div> :imageUrl="hasImage(child) ? child.relationships?.image?.meta?.['download-url'] : ''"
<studip-ident-image >
v-else <template #description>
:baseColor="getColor(child).hex" {{ child.attributes.payload.description }}
:pattern="child.attributes.title" </template>
:showCanvas="true" <template #footer>
/> <p class="cw-root-content-toc-tile-footer">
<div class="description"> {{
<header $gettextInterpolate(
:class="[ $ngettext('%{pages} Seite', '%{pages} Seiten', countChildChildren(child)),
child.attributes.purpose !== '' { pages: countChildChildren(child) }
? 'description-icon-' + child.attributes.purpose )
: '', }}
]" </p>
> </template>
{{ child.attributes.title || '–' }} </courseware-tile>
</header>
<div class="description-text-wrapper">
<p>{{ child.attributes.payload.description }}</p>
</div>
<footer>
{{ countChildChildren(child) }}
<translate :translate-n="countChildChildren(child)" translate-plural="Seiten">
Seite
</translate>
</footer>
</div>
</router-link> </router-link>
</li> </li>
</ul> </ul>
...@@ -93,6 +77,7 @@ ...@@ -93,6 +77,7 @@
<script> <script>
import CoursewareCompanionBox from './../layouts/CoursewareCompanionBox.vue'; import CoursewareCompanionBox from './../layouts/CoursewareCompanionBox.vue';
import CoursewareTile from './../layouts/CoursewareTile.vue';
import StudipIdentImage from './../../StudipIdentImage.vue'; import StudipIdentImage from './../../StudipIdentImage.vue';
import colorMixin from '@/vue/mixins/courseware/colors.js'; import colorMixin from '@/vue/mixins/courseware/colors.js';
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
...@@ -100,18 +85,19 @@ import { mapActions, mapGetters } from 'vuex'; ...@@ -100,18 +85,19 @@ import { mapActions, mapGetters } from 'vuex';
export default { export default {
name: 'courseware-root-content', name: 'courseware-root-content',
mixins: [colorMixin], mixins: [colorMixin],
props: {
structuralElement: Object,
canEdit: Boolean,
},
components: { components: {
CoursewareCompanionBox, CoursewareCompanionBox,
CoursewareTile,
StudipIdentImage, StudipIdentImage,
}, },
props: {
structuralElement: Object,
canEdit: Boolean,
},
data() { data() {
return { return {
identImage: '', identImage: '',
identImageCanvas: '', identBgImage: '',
}; };
}, },
computed: { computed: {
...@@ -131,6 +117,18 @@ export default { ...@@ -131,6 +117,18 @@ export default {
let style = {}; let style = {};
const backgroundURL = this.imageIsSet ? this.imageURL : this.identImage; const backgroundURL = this.imageIsSet ? this.imageURL : this.identImage;
style.backgroundImage = 'url(' + backgroundURL + ')';
if (!this.imageIsSet) {
style.backgroundSize = '100% auto';
style.height = '180px';
}
return style;
},
bgImage() {
let style = {};
const backgroundURL = this.imageIsSet ? this.imageURL : this.identBgImage;
style.backgroundImage = 'url(' + backgroundURL + ')'; style.backgroundImage = 'url(' + backgroundURL + ')';
style.height = this.withTOC ? '300px' : '480px'; style.height = this.withTOC ? '300px' : '480px';
...@@ -180,7 +178,7 @@ export default { ...@@ -180,7 +178,7 @@ export default {
}, },
addPage() { addPage() {
this.showElementAddDialog(true); this.showElementAddDialog(true);
} },
}, },
}; };
</script> </script>
...@@ -203,9 +201,10 @@ export default { ...@@ -203,9 +201,10 @@ export default {
top: 8em; top: 8em;
.cw-root-content-description-img { .cw-root-content-description-img {
width: 240px; width: 270px;
height: fit-content; height: fit-content;
margin-right: 2em; margin-right: 2em;
background-color: #fff;
} }
.cw-root-content-description-text { .cw-root-content-description-text {
max-height: calc(480px - 18em); max-height: calc(480px - 18em);
...@@ -239,6 +238,9 @@ export default { ...@@ -239,6 +238,9 @@ export default {
max-height: calc(300px - 6em); max-height: calc(300px - 6em);
} }
} }
.cw-root-content-toc-tile-footer {
line-height: 4em;
}
} }
.cw-root-content-hint { .cw-root-content-hint {
max-width: 1095px; max-width: 1095px;
......
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