Skip to content
Snippets Groups Projects
Commit 7bbf7a9f authored by Farbod Zamani's avatar Farbod Zamani Committed by Marcus Eibrink-Lunzenauer
Browse files

CW: GalleryBlock mouseover filename new feature

Closes #1742

Merge request studip/studip!1165
parent d644a64b
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
}, },
"show_filenames": { "show_filenames": {
"type": "string" "type": "string"
},
"mouseover_filenames": {
"type": "string"
} }
}, },
"required": [ "required": [
......
...@@ -94,6 +94,7 @@ class Gallery extends BlockType ...@@ -94,6 +94,7 @@ class Gallery extends BlockType
'nav' => 'true', 'nav' => 'true',
'height' => '610', 'height' => '610',
'show_filenames' => 'true', 'show_filenames' => 'true',
'mouseover_filenames' => 'false',
]; ];
} }
......
...@@ -4070,6 +4070,14 @@ g a l l e r y b l o c k ...@@ -4070,6 +4070,14 @@ g a l l e r y b l o c k
background-color: fade-out($black, 0.6); background-color: fade-out($black, 0.6);
padding: 0.5em; padding: 0.5em;
} }
&.show-on-hover {
display: none;
}
}
.cw-block-gallery-content:hover .show-on-hover {
display: block;
} }
.cw-block-gallery-number-text { .cw-block-gallery-number-text {
......
...@@ -27,7 +27,8 @@ ...@@ -27,7 +27,8 @@
} }
" "
/> />
<div v-if="currentShowFileNames === 'true'" class="cw-block-gallery-file-name"> <div v-if="currentShowFileNames === 'true' && image?.attributes?.name" class="cw-block-gallery-file-name"
:class="{'show-on-hover': currentMouseoverFileNames === 'true'}">
<span>{{ image.attributes.name }}</span> <span>{{ image.attributes.name }}</span>
</div> </div>
</div> </div>
...@@ -72,6 +73,15 @@ ...@@ -72,6 +73,15 @@
<option value="false"><translate>Nein</translate></option> <option value="false"><translate>Nein</translate></option>
</select> </select>
</label> </label>
<label v-if="currentShowFileNames === 'true'">
{{ $gettext('Dateiname erscheint bei Mouseover') }}
<studip-tooltip-icon
:text="$gettext('Der Dateiname wird angezeigt, wenn Sie den Mauszeiger über den Inhalt bewegen.')"/>
<select v-model="currentMouseoverFileNames">
<option value="true"><translate>Ja</translate></option>
<option value="false"><translate>Nein</translate></option>
</select>
</label>
</form> </form>
</template> </template>
<template #info> <template #info>
...@@ -106,6 +116,7 @@ export default { ...@@ -106,6 +116,7 @@ export default {
currentNav: '', currentNav: '',
currentHeight: '', currentHeight: '',
currentShowFileNames: '', currentShowFileNames: '',
currentMouseoverFileNames: '',
currentAutoplayTimer: '', currentAutoplayTimer: '',
editModeFiles: [], editModeFiles: [],
slideIndex: 0, slideIndex: 0,
...@@ -136,6 +147,9 @@ export default { ...@@ -136,6 +147,9 @@ export default {
showFileNames() { showFileNames() {
return this.block?.attributes?.payload?.show_filenames; return this.block?.attributes?.payload?.show_filenames;
}, },
mouseoverFileNames() {
return this.block?.attributes?.payload?.mouseover_filenames ?? 'false';
},
files() { files() {
if (!this.editMode) { if (!this.editMode) {
return this.block?.attributes?.payload?.files; return this.block?.attributes?.payload?.files;
...@@ -158,6 +172,7 @@ export default { ...@@ -158,6 +172,7 @@ export default {
this.currentNav = this.nav; this.currentNav = this.nav;
this.currentHeight = this.height; this.currentHeight = this.height;
this.currentShowFileNames = this.showFileNames; this.currentShowFileNames = this.showFileNames;
this.currentMouseoverFileNames = this.mouseoverFileNames;
}, },
startGallery() { startGallery() {
this.slideIndex = 0; this.slideIndex = 0;
...@@ -218,6 +233,7 @@ export default { ...@@ -218,6 +233,7 @@ export default {
attributes.payload.nav = this.currentNav; attributes.payload.nav = this.currentNav;
attributes.payload.height = this.currentHeight; attributes.payload.height = this.currentHeight;
attributes.payload.show_filenames = this.currentShowFileNames; attributes.payload.show_filenames = this.currentShowFileNames;
attributes.payload.mouseover_filenames = this.currentMouseoverFileNames;
this.updateBlock({ this.updateBlock({
attributes: attributes, attributes: attributes,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment