aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Lucke <lucke@elan-ev.de>2026-03-04 10:27:05 +0100
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2026-03-11 15:55:23 +0100
commitc174918724048c5a4fd8069a50c0430ea09d6ed6 (patch)
treeb1d967fca23943cf1e0f4ff1e1de73b780bd60cb
parent75c2c2c55f1538984312e94a66b89de102c1df43 (diff)
Fehlende Funktionen in HeadlineBlock
Closes #6319 Merge request studip/studip!4790
-rw-r--r--resources/vue/components/courseware/blocks/CoursewareHeadlineBlock.vue91
1 files changed, 56 insertions, 35 deletions
diff --git a/resources/vue/components/courseware/blocks/CoursewareHeadlineBlock.vue b/resources/vue/components/courseware/blocks/CoursewareHeadlineBlock.vue
index 818c54c..c705df0 100644
--- a/resources/vue/components/courseware/blocks/CoursewareHeadlineBlock.vue
+++ b/resources/vue/components/courseware/blocks/CoursewareHeadlineBlock.vue
@@ -108,18 +108,12 @@
{{ $gettext('Es steht keine Auswahl zur Verfügung.') }}
</template>
<template #selected-option="option">
- <span
- class="vs__option-color"
- :style="{ 'background-color': option.hex }"
- ></span
- ><span>{{ option.name }}</span>
+ <span class="vs__option-color" :style="{ 'background-color': option.hex }"></span>
+ <span>{{ option.name }}</span>
</template>
<template #option="option">
- <span
- class="vs__option-color"
- :style="{ 'background-color': option.hex }"
- ></span
- ><span>{{ option.name }}</span>
+ <span class="vs__option-color" :style="{ 'background-color': option.hex }"></span>
+ <span>{{ option.name }}</span>
</template>
</StudipSelect>
<template v-if="hasTextBackgroundColor">
@@ -138,18 +132,18 @@
{{ $gettext('Es steht keine Auswahl zur Verfügung.') }}
</template>
<template #selected-option="option">
- <span
- class="vs__option-color"
- :style="{ 'background-color': option.hex }"
- ></span
- ><span>{{ option.name }}</span>
+ <span
+ class="vs__option-color"
+ :style="{ 'background-color': option.hex }">
+ </span>
+ <span>{{ option.name }}</span>
</template>
<template #option="option">
- <span
- class="vs__option-color"
- :style="{ 'background-color': option.hex }"
- ></span
- ><span>{{ option.name }}</span>
+ <span
+ class="vs__option-color"
+ :style="{ 'background-color': option.hex }">
+ </span>
+ <span>{{ option.name }}</span>
</template>
</StudipSelect>
</template>
@@ -205,18 +199,18 @@
{{ $gettext('Es steht keine Auswahl zur Verfügung.') }}
</template>
<template #selected-option="option">
- <span
- class="vs__option-color"
- :style="{ 'background-color': option.hex }"
- ></span
- ><span>{{ option.name }}</span>
+ <span
+ class="vs__option-color"
+ :style="{ 'background-color': option.hex }">
+ </span>
+ <span>{{ option.name }}</span>
</template>
<template #option="option">
- <span
- class="vs__option-color"
- :style="{ 'background-color': option.hex }"
- ></span
- ><span>{{ option.name }}</span>
+ <span
+ class="vs__option-color"
+ :style="{ 'background-color': option.hex }">
+ </span>
+ <span>{{ option.name }}</span>
</template>
</StudipSelect>
</template>
@@ -387,9 +381,6 @@ export default {
backgroundType() {
return this.block?.attributes?.payload?.background_type;
},
- complementBackgroundColor() {
- return this.calcComplement(this.backgroundColor);
- },
icons() {
return this.contentIcons;
},
@@ -496,7 +487,7 @@ export default {
download_url: this.urlHelper.getURL(
'sendfile.php',
{ type: 0, file_id: fileRef.id, file_name: fileRef.attributes.name },
- true
+ true,
),
});
}
@@ -579,6 +570,37 @@ export default {
this.currentBackgroundImage = {};
this.selectedStockImage = null;
},
+
+ calcRGB(color) {
+ color = color.slice(1);
+ let val = parseInt(color, 16);
+ let r = val >> 16;
+ let g = (val >> 8) & 0x00ff;
+ let b = val & 0x0000ff;
+
+ if (r > 255) {
+ r = 255;
+ } else if (r < 0) {
+ r = 0;
+ }
+ if (g > 255) {
+ g = 255;
+ } else if (g < 0) {
+ g = 0;
+ }
+ if (b > 255) {
+ b = 255;
+ } else if (b < 0) {
+ b = 0;
+ }
+
+ return { r, g, b };
+ },
+ hexToRgbA(hex, a) {
+ const {r, g, b} = this.calcRGB(hex);
+
+ return `rgba(${r}, ${g}, ${b}, ${a})`;
+ },
},
watch: {
currentBackgroundImageId(newValue) {
@@ -586,7 +608,6 @@ export default {
this.onSelectFile(newValue);
}
},
-
},
};
</script>