From c80c98158137dd46c7053b5aa13337333c5b7e98 Mon Sep 17 00:00:00 2001 From: indy koning Date: Fri, 19 Dec 2025 10:45:52 +0100 Subject: [PATCH 1/3] Added external video support --- config/rapidez/models.php | 1 + resources/js/components/Product/Images.vue | 8 ++- .../product/partials/gallery/popup.blade.php | 18 ++++- .../product/partials/gallery/slider.blade.php | 25 +++++-- .../partials/gallery/thumbnails.blade.php | 15 ++-- .../gallery/thumbnails/show-more.blade.php | 8 +-- .../views/product/partials/images.blade.php | 2 +- src/Http/Controllers/ProductController.php | 1 + src/Models/Product.php | 16 ++++- src/Models/ProductImage.php | 7 +- src/Models/ProductVideoValue.php | 10 +++ src/RapidezServiceProvider.php | 72 +++++++++++++++++++ 12 files changed, 158 insertions(+), 25 deletions(-) create mode 100644 src/Models/ProductVideoValue.php diff --git a/config/rapidez/models.php b/config/rapidez/models.php index 864efc62c..d1575a9dc 100644 --- a/config/rapidez/models.php +++ b/config/rapidez/models.php @@ -15,6 +15,7 @@ 'option_value' => Rapidez\Core\Models\OptionValue::class, 'product_image' => Rapidez\Core\Models\ProductImage::class, 'product_image_value' => Rapidez\Core\Models\ProductImageValue::class, + 'product_video_value' => Rapidez\Core\Models\ProductVideoValue::class, 'product_link' => Rapidez\Core\Models\ProductLink::class, 'product_view' => Rapidez\Core\Models\ProductView::class, 'product_option' => Rapidez\Core\Models\ProductOption::class, diff --git a/resources/js/components/Product/Images.vue b/resources/js/components/Product/Images.vue index 3318c00aa..9906a1d11 100644 --- a/resources/js/components/Product/Images.vue +++ b/resources/js/components/Product/Images.vue @@ -4,6 +4,7 @@ import { useEventListener } from '@vueuse/core' export default { data: () => ({ images: config.product.images, + media: config.product.product_gallery, active: 0, zoomed: false, touchStartX: 0, @@ -30,7 +31,8 @@ export default { Object.values(window.config.product.super_attributes).filter((attribute) => attribute.update_image).length ) { self.images = simpleProduct.images - self.active = Math.min(self.active, self.images.length - 1) + self.media = simpleProduct.product_gallery + self.active = Math.min(self.active, self.media.length - 1) } }) }) @@ -52,7 +54,7 @@ export default { if (e.key == 'ArrowLeft' && this.active > 0) { // left this.active-- - } else if (e.key == 'ArrowRight' && this.active < this.images.length - 1) { + } else if (e.key == 'ArrowRight' && this.active < this.media.length - 1) { // right this.active++ } else if (e.key == 'Escape') { @@ -77,7 +79,7 @@ export default { return } - if (distance < 0 && this.active < this.images.length - 1) { + if (distance < 0 && this.active < this.media.length - 1) { this.change(this.active + 1) } else if (distance > 0 && this.active > 0) { this.change(this.active - 1) diff --git a/resources/views/product/partials/gallery/popup.blade.php b/resources/views/product/partials/gallery/popup.blade.php index 1959bbaec..642ff12f1 100644 --- a/resources/views/product/partials/gallery/popup.blade.php +++ b/resources/views/product/partials/gallery/popup.blade.php @@ -1,11 +1,23 @@ -
+
{{ $product->name }} +
@@ -13,7 +25,7 @@ class="object-contain max-h-full mx-auto block" -
diff --git a/resources/views/product/partials/gallery/slider.blade.php b/resources/views/product/partials/gallery/slider.blade.php index 018e951a4..8034524c9 100644 --- a/resources/views/product/partials/gallery/slider.blade.php +++ b/resources/views/product/partials/gallery/slider.blade.php @@ -1,13 +1,14 @@ -
+
{{ $product->name }} + - @if (count($selectedChild->images ?? []) > 1) + @if (count($selectedChild->product_gallery ?? []) > 1) - @endif diff --git a/resources/views/product/partials/gallery/thumbnails.blade.php b/resources/views/product/partials/gallery/thumbnails.blade.php index a9595c6b2..7760f2dba 100644 --- a/resources/views/product/partials/gallery/thumbnails.blade.php +++ b/resources/views/product/partials/gallery/thumbnails.blade.php @@ -10,8 +10,8 @@ @for ($imageId = 0; $imageId < max($breakpoints); $imageId++) diff --git a/resources/views/product/partials/gallery/thumbnails.blade.php b/resources/views/product/partials/gallery/thumbnails.blade.php index 7760f2dba..f6095914c 100644 --- a/resources/views/product/partials/gallery/thumbnails.blade.php +++ b/resources/views/product/partials/gallery/thumbnails.blade.php @@ -10,7 +10,7 @@ @for ($imageId = 0; $imageId < max($breakpoints); $imageId++)