From 24dfc47e992b40ca6c2ebac8be64b18a1be18a95 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 4 Dec 2020 17:04:17 +0100 Subject: [PATCH] wait #4054 @2.5 --- app/Models/Product.php | 7 ++++--- public/images/product-details/icon-cad.svg | 1 + .../product-details/icon-dimensions_doc.svg | 1 + .../images/product-details/icon-document.svg | 20 ------------------- .../product-details/icon-documentation.svg | 1 + .../images/product-details/icon-software.svg | 1 + public/images/product-details/icon-tech.svg | 14 ------------- .../product-details/icon-technical_sheet.svg | 1 + .../views/pages/product-detail.blade.php | 3 ++- 9 files changed, 11 insertions(+), 38 deletions(-) create mode 100644 public/images/product-details/icon-cad.svg create mode 100644 public/images/product-details/icon-dimensions_doc.svg delete mode 100644 public/images/product-details/icon-document.svg create mode 100644 public/images/product-details/icon-documentation.svg create mode 100644 public/images/product-details/icon-software.svg delete mode 100644 public/images/product-details/icon-tech.svg create mode 100644 public/images/product-details/icon-technical_sheet.svg diff --git a/app/Models/Product.php b/app/Models/Product.php index a8ac619..745bd17 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -32,7 +32,7 @@ class Product extends CubistMagicPageModel public function __construct(array $attributes = []) { - $this->_documents = ['technical_sheet' => 'Fiche technique', 'documentation' => 'Documentation', 'dimensions_doc' => 'Dimensions']; + $this->_documents = ['technical_sheet' => 'Fiche technique', 'documentation' => 'Documentation', 'dimensions_doc' => 'Dimensions', 'cad' => 'CAO', 'software' => 'Programme']; parent::__construct($attributes); } @@ -257,8 +257,9 @@ class Product extends CubistMagicPageModel foreach ($this->_documents as $fieldName => $label) { foreach ($this->getMediaInField($this->$fieldName) as $media) { /** @var $media Media */ - - $res[] = ['media' => $media, 'label' => $label, 'type' => in_array($media->getExtensionAttribute(), $typedocs) ? 'tech' : 'document']; + $e = explode('/', $media->getUrl()); + $fname = array_pop($e); + $res[] = ['media' => $media, 'label' => $media->getCustomProperty('alt') ?: $fname, 'tooltip' => $label, 'type' => $fieldName]; } } diff --git a/public/images/product-details/icon-cad.svg b/public/images/product-details/icon-cad.svg new file mode 100644 index 0000000..55ddcc4 --- /dev/null +++ b/public/images/product-details/icon-cad.svg @@ -0,0 +1 @@ + diff --git a/public/images/product-details/icon-dimensions_doc.svg b/public/images/product-details/icon-dimensions_doc.svg new file mode 100644 index 0000000..3bf3305 --- /dev/null +++ b/public/images/product-details/icon-dimensions_doc.svg @@ -0,0 +1 @@ + diff --git a/public/images/product-details/icon-document.svg b/public/images/product-details/icon-document.svg deleted file mode 100644 index 6309327..0000000 --- a/public/images/product-details/icon-document.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/public/images/product-details/icon-documentation.svg b/public/images/product-details/icon-documentation.svg new file mode 100644 index 0000000..0b502e2 --- /dev/null +++ b/public/images/product-details/icon-documentation.svg @@ -0,0 +1 @@ + diff --git a/public/images/product-details/icon-software.svg b/public/images/product-details/icon-software.svg new file mode 100644 index 0000000..c857a45 --- /dev/null +++ b/public/images/product-details/icon-software.svg @@ -0,0 +1 @@ + diff --git a/public/images/product-details/icon-tech.svg b/public/images/product-details/icon-tech.svg deleted file mode 100644 index e78821b..0000000 --- a/public/images/product-details/icon-tech.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/public/images/product-details/icon-technical_sheet.svg b/public/images/product-details/icon-technical_sheet.svg new file mode 100644 index 0000000..60ba8fe --- /dev/null +++ b/public/images/product-details/icon-technical_sheet.svg @@ -0,0 +1 @@ + diff --git a/resources/views/pages/product-detail.blade.php b/resources/views/pages/product-detail.blade.php index 25f660a..a3c5951 100644 --- a/resources/views/pages/product-detail.blade.php +++ b/resources/views/pages/product-detail.blade.php @@ -79,7 +79,8 @@ @foreach($product->getEntity()->getDocuments() as $document)
  • + data-tooltip="{{$document['tooltip']}}" + class="inline-flex items-center text-grey-dark hover:text-primary"> {{__('Icône %s',[$document['type']])}} -- 2.39.5