Improved product picture display on the productcard

This commit is contained in:
Bernd Bestel
2019-09-20 20:10:03 +02:00
parent c228126c3a
commit 653098a81e
2 changed files with 1 additions and 5 deletions

View File

@@ -80,13 +80,11 @@ Grocy.Components.ProductCard.Refresh = function(productId)
if (productDetails.product.picture_file_name !== null && !productDetails.product.picture_file_name.isEmpty()) if (productDetails.product.picture_file_name !== null && !productDetails.product.picture_file_name.isEmpty())
{ {
$("#productcard-no-product-picture").addClass("d-none");
$("#productcard-product-picture").removeClass("d-none"); $("#productcard-product-picture").removeClass("d-none");
$("#productcard-product-picture").attr("src", U('/api/files/productpictures/' + btoa(productDetails.product.picture_file_name) + '?force_serve_as=picture&best_fit_width=400')); $("#productcard-product-picture").attr("src", U('/api/files/productpictures/' + btoa(productDetails.product.picture_file_name) + '?force_serve_as=picture&best_fit_width=400'));
} }
else else
{ {
$("#productcard-no-product-picture").removeClass("d-none");
$("#productcard-product-picture").addClass("d-none"); $("#productcard-product-picture").addClass("d-none");
} }

View File

@@ -27,9 +27,7 @@
@if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)<strong>{{ $__t('Average shelf life') }}:</strong> <span id="productcard-product-average-shelf-life"></span><br>@endif @if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)<strong>{{ $__t('Average shelf life') }}:</strong> <span id="productcard-product-average-shelf-life"></span><br>@endif
<strong>{{ $__t('Spoil rate') }}:</strong> <span id="productcard-product-spoil-rate"></span> <strong>{{ $__t('Spoil rate') }}:</strong> <span id="productcard-product-spoil-rate"></span>
<h5 class="mt-3">{{ $__t('Product picture') }}</h5> <p class="w-75 mt-3 mx-auto"><img id="productcard-product-picture" data-src="" class="img-fluid img-thumbnail d-none lazy"></p>
<p class="w-75 mx-auto"><img id="productcard-product-picture" data-src="" class="img-fluid img-thumbnail d-none lazy"></p>
<span id="productcard-no-product-picture" class="font-italic d-none">{{ $__t('No picture available') }}</span>
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
<h5 class="mt-3">{{ $__t('Price history') }}</h5> <h5 class="mt-3">{{ $__t('Price history') }}</h5>