Merge pull request #5701 from Matt-Yorkley/noimage

Noimage
This commit is contained in:
Luis Ramos
2020-07-02 20:17:04 +01:00
committed by GitHub
18 changed files with 17 additions and 23 deletions

View File

@@ -34,7 +34,7 @@ Darkswarm.factory 'Products', (OrderCycleResource, OrderCycle, Shopfront, curren
product.price = Math.min.apply(null, prices)
product.hasVariants = product.variants?.length > 0
product.primaryImage = product.images[0]?.small_url if product.images
product.primaryImageOrMissing = product.primaryImage || "/assets/noimage/small.png"
product.primaryImageOrMissing = product.primaryImage || "/noimage/small.png"
product.largeImage = product.images[0]?.large_url if product.images
dereference: ->

View File

@@ -15,6 +15,6 @@
.columns.small-12.medium-6.large-6.product-img
%img{"ng-src" => "{{::product.largeImage}}", "ng-if" => "::product.largeImage"}
%img.placeholder{ src: "/assets/noimage/large.png", "ng-if" => "::!product.largeImage"}
%img.placeholder{ src: "/noimage/large.png", "ng-if" => "::!product.largeImage"}
%ng-include{src: "'partials/close.html'"}

View File

@@ -12,7 +12,7 @@ class Api::Admin::ProductSerializer < ActiveModel::Serializer
if object.images.present?
object.images.first.attachment.url(:product)
else
"/assets/noimage/product.png"
"/noimage/product.png"
end
end
@@ -20,7 +20,7 @@ class Api::Admin::ProductSerializer < ActiveModel::Serializer
if object.images.present?
object.images.first.attachment.url(:mini)
else
"/assets/noimage/mini.png"
"/noimage/mini.png"
end
end

View File

@@ -35,7 +35,7 @@ class Api::VariantSerializer < ActiveModel::Serializer
if object.product.images.present?
object.product.images.first.attachment.url(:mini)
else
"/assets/noimage/mini.png"
"/noimage/mini.png"
end
end
end

View File

@@ -22,7 +22,7 @@
- if @group.logo.present?
%img.group-logo{"src" => @group.logo}
- else
%img.group-logo{"src" => image_path('noimage/group.png') }
%img.group-logo{"src" => '/noimage/group.png' }
%h2.group-name= @group.name
%p= @group.description

View File

@@ -83,7 +83,7 @@
%fieldset.no-border-bottom{ id: "image" }
%legend{align: "center"}= t(".image")
.row
= image_tag "noimage/product.png", class: "four columns alpha"
= image_tag "/noimage/product.png", class: "four columns alpha"
.row
= f.fields_for 'images_attributes[]', f.object.images.build do |image_fields|
= image_fields.file_field :attachment

View File

@@ -4,7 +4,7 @@
{{#if variant.image }}
<img src='{{variant.image}}' />
{{ else }}
<img src='<%= image_path("noimage/mini.png") %>' />
<img src='/noimage/mini.png' />
{{/if}}
</figure>

View File

@@ -16,10 +16,7 @@
%td.cart-item-description
%div.item-thumb-image
- if variant.images.length == 0
= mini_image(variant.product)
- else
= image_tag(variant.images.first.attachment.url(:mini))
= render 'spree/shared/variant_thumbnail', variant: variant
= render 'spree/shared/line_item_name', line_item: line_item
%span.already-confirmed= t(:orders_bought_already_confirmed)

View File

@@ -2,10 +2,7 @@
%td.cart-item-description{'data-hook' => "cart_item_description"}
%div.item-thumb-image{"data-hook" => "cart_item_image"}
- if variant.images.length == 0
= mini_image(variant.product)
- else
= image_tag(variant.images.first.attachment.url(:mini))
= render 'spree/shared/variant_thumbnail', variant: variant
= render 'spree/shared/line_item_name', line_item: line_item

View File

@@ -16,11 +16,7 @@
%td(data-hook = "order_item_description")
%div.item-thumb-image{"data-hook" => "order_item_image"}
- if item.variant.images.length == 0
= mini_image(item.variant.product)
- else
= image_tag(item.variant.images.first.attachment.url(:mini))
= render 'spree/shared/variant_thumbnail', variant: item.variant
= render 'spree/shared/line_item_name', line_item: item

View File

@@ -0,0 +1,4 @@
- if variant.product.images.length == 0
= image_tag("/noimage/mini.png")
- else
= image_tag(variant.product.images.first.attachment.url(:mini))

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 957 B

After

Width:  |  Height:  |  Size: 957 B

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -770,7 +770,7 @@ feature '
expect(page).to have_selector "td.image"
# Shows default image when no image set
expect(page).to have_css "img[src='/assets/noimage/mini.png']"
expect(page).to have_css "img[src='/noimage/mini.png']"
@old_thumb_src = page.find("a.image-modal img")['src']
# Click image

View File

@@ -107,7 +107,7 @@ describe 'Products service', ->
$httpBackend.expectGET(endpoint).respond([product])
$httpBackend.flush()
expect(Products.products[0].primaryImage).toBeUndefined()
expect(Products.products[0].primaryImageOrMissing).toEqual "/assets/noimage/small.png"
expect(Products.products[0].primaryImageOrMissing).toEqual "/noimage/small.png"
it "sets largeImage", ->
$httpBackend.expectGET(endpoint).respond([productWithImage])