From 2560039fa6dbe7c50b2e434d651b29026b5606fd Mon Sep 17 00:00:00 2001 From: indy koning Date: Fri, 19 Dec 2025 10:36:48 +0100 Subject: [PATCH 1/5] 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 | 14 ++-- .../gallery/thumbnails/show-more.blade.php | 8 +-- .../views/product/partials/images.blade.php | 2 +- src/Http/Controllers/ProductController.php | 1 + src/Models/Product.php | 15 ++++ src/Models/ProductImage.php | 7 +- src/Models/ProductVideoValue.php | 10 +++ src/RapidezServiceProvider.php | 72 +++++++++++++++++++ 12 files changed, 158 insertions(+), 23 deletions(-) create mode 100644 src/Models/ProductVideoValue.php diff --git a/config/rapidez/models.php b/config/rapidez/models.php index 3204acc45..719de666b 100644 --- a/config/rapidez/models.php +++ b/config/rapidez/models.php @@ -22,6 +22,7 @@ 'product' => Rapidez\Core\Models\Product::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_option' => Rapidez\Core\Models\ProductOption::class, 'product_option_price' => Rapidez\Core\Models\ProductOptionPrice::class, diff --git a/resources/js/components/Product/Images.vue b/resources/js/components/Product/Images.vue index 613e53857..8401a18f2 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, @@ -32,7 +33,8 @@ export default { ).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) } }) }) @@ -54,7 +56,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') { @@ -79,7 +81,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 7d874480c..8bbc9ea09 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 92ee9b478..2f4ca885f 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 03b450076..c87babd88 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++)