Replace admin/variants/search rabl template with existing admin variant serializer with a few added attributes

This commit fixes a bug as the image of the variatn was not being rendered, we need to fetch the image of the product, not the image of the variant.
This commit is contained in:
luisramos0
2019-07-23 12:31:07 +01:00
parent 5739a82c19
commit 7e6259da31
5 changed files with 21 additions and 12 deletions

View File

@@ -27,8 +27,6 @@ angular.module("admin.utils").directive "variantAutocomplete", ($timeout) ->
window.variants = data # this is how spree auto complete JS code picks up variants
results: data
formatResult: (variant) ->
if variant["images"][0] != undefined && variant["images"][0].image != undefined
variant.image = variant.images[0].image.mini_url
variantTemplate variant: variant
formatSelection: (variant) ->
element.parent().children(".options_placeholder").html variant.options_text