From 898ff763a1e9b482d87acd017fb3d0a3ff0f3e93 Mon Sep 17 00:00:00 2001 From: Ron Lucke Date: Thu, 22 Jun 2023 08:32:25 +0000 Subject: Erweiterung des Galerie Blocks Closes #2016 Merge request studip/studip!1465 --- lib/models/Courseware/BlockTypes/Gallery.json | 9 + lib/models/Courseware/BlockTypes/Gallery.php | 6 +- resources/assets/stylesheets/scss/courseware.scss | 52 ++++- .../courseware/CoursewareGalleryBlock.vue | 239 +++++++++++++++------ 4 files changed, 229 insertions(+), 77 deletions(-) diff --git a/lib/models/Courseware/BlockTypes/Gallery.json b/lib/models/Courseware/BlockTypes/Gallery.json index a71ca36..205816c 100644 --- a/lib/models/Courseware/BlockTypes/Gallery.json +++ b/lib/models/Courseware/BlockTypes/Gallery.json @@ -5,6 +5,9 @@ "folder_id": { "type": "string" }, + "layout": { + "type": "string" + }, "autoplay": { "type": "string" }, @@ -17,9 +20,15 @@ "height": { "type": "string" }, + "cols": { + "type": "string" + }, "show_filenames": { "type": "string" }, + "show_description": { + "type": "string" + }, "mouseover_filenames": { "type": "string" } diff --git a/lib/models/Courseware/BlockTypes/Gallery.php b/lib/models/Courseware/BlockTypes/Gallery.php index 7363a7c..5f9bb0b 100644 --- a/lib/models/Courseware/BlockTypes/Gallery.php +++ b/lib/models/Courseware/BlockTypes/Gallery.php @@ -59,6 +59,7 @@ class Gallery extends BlockType 'name' => $folderFile->name, 'mime-type' => $folderFile->mime_type, 'filesize' => (int) $folderFile->size, + 'description' => $fileRef->description, 'mkdate' => date('c', $folderFile->mkdate), ]; $file['relationships'] = [ @@ -89,11 +90,14 @@ class Gallery extends BlockType { return [ 'folder_id' => '', + 'layout' => 'carousel', 'autoplay' => 'false', 'autoplay_timer' => '2', 'nav' => 'true', - 'height' => '610', + 'height' => '620', + 'cols' => '25', 'show_filenames' => 'true', + 'show_description' => 'false', 'mouseover_filenames' => 'false', ]; } diff --git a/resources/assets/stylesheets/scss/courseware.scss b/resources/assets/stylesheets/scss/courseware.scss index 1d3c1fe..77e8491 100644 --- a/resources/assets/stylesheets/scss/courseware.scss +++ b/resources/assets/stylesheets/scss/courseware.scss @@ -3807,17 +3807,22 @@ g a l l e r y b l o c k } } -.cw-block-gallery-file-name { - color: $white; +.cw-block-gallery-file-description { + width: -moz-available; + color: var(--white); font-size: 15px; padding: 8px 12px; position: absolute; bottom: 8px; - width: 100%; text-align: center; - span { + p { + display: -webkit-inline-box; background-color: fade-out($black, 0.6); - padding: 0.5em; + padding: 0 2em; + margin-bottom: 4px; + overflow: hidden; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; } &.show-on-hover { @@ -3830,7 +3835,7 @@ g a l l e r y b l o c k } .cw-block-gallery-number-text { - color: $white; + color: var(--white); font-size: 12px; padding: 8px 12px; position: absolute; @@ -3855,6 +3860,41 @@ g a l l e r y b l o c k to {opacity: 1} } + +.cw-block-gallery-grid { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: flex-start; + list-style: none; + padding: 0; + figure { + padding: 1px 4px; + margin: unset; + figcaption { + margin-bottom: 12px; + + .cw-block-gallery-grid-file-name { + font-weight: 700; + margin-bottom: 4px; + overflow: hidden; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + } + .cw-block-gallery-grid-file-description { + overflow: hidden; + display: -webkit-box; + -webkit-line-clamp: 5; + -webkit-box-orient: vertical; + } + } + } +} +.cw-container-wrapper-edit .cw-block-gallery-grid { + margin: 0; +} + /* * * * * * * * * * * * * * * * * g a l l e r y b l o c k e n d * * * * * * * * * * * * * * * * */ diff --git a/resources/vue/components/courseware/CoursewareGalleryBlock.vue b/resources/vue/components/courseware/CoursewareGalleryBlock.vue index f6d41ab..ff730d0 100644 --- a/resources/vue/components/courseware/CoursewareGalleryBlock.vue +++ b/resources/vue/components/courseware/CoursewareGalleryBlock.vue @@ -10,82 +10,152 @@ @closeEdit="closeEdit" > @@ -94,6 +164,8 @@