diff --git a/app/serializers/spree/image_serializer.rb b/app/serializers/spree/image_serializer.rb index 0cf3ee8295..07e86eacb6 100644 --- a/app/serializers/spree/image_serializer.rb +++ b/app/serializers/spree/image_serializer.rb @@ -1,6 +1,10 @@ module Spree class ImageSerializer < ActiveModel::Serializer - attributes :id, :mini_url, :alt + attributes :id, :small_url, :alt + + def small_url + object.attachment.url(:small, false) + end end end diff --git a/app/views/shop/_products.html.haml b/app/views/shop/_products.html.haml index 3e50e929a9..38cf931aef 100644 --- a/app/views/shop/_products.html.haml +++ b/app/views/shop/_products.html.haml @@ -12,7 +12,7 @@ %tbody{"ng-repeat" => "product in data.products "} %tr.product %td - -#{{ product.master.images[0].mini_url }} + %img{src: "{{ product.master.images[0].small_url }}"} -#{{product.master.images[0].alt}} %td %h5 diff --git a/app/views/shop/show.html.haml b/app/views/shop/show.html.haml index 268b5f75ef..1e0e806002 100644 --- a/app/views/shop/show.html.haml +++ b/app/views/shop/show.html.haml @@ -1,7 +1,7 @@ %shop{"ng-app" => "Shop"} %navigation %distributor.details.row - %img.left{src: ""} + -#%img.left{src: @distributor.} %h4 = @distributor.name %location= @distributor.address.city diff --git a/spec/serializers/spree/image_serializer_spec.rb b/spec/serializers/spree/image_serializer_spec.rb new file mode 100644 index 0000000000..ced92da3c3 --- /dev/null +++ b/spec/serializers/spree/image_serializer_spec.rb @@ -0,0 +1,9 @@ +require 'spec_helper' + +describe Spree::ImageSerializer do + it "should give us the small url" do + image = Spree::Image.new(attachment: double(:attachment)) + image.attachment.should_receive(:url).with(:small, false) + Spree::ImageSerializer.new(image).to_json + end +end