Adding serializers also

This commit is contained in:
Will Marshall
2013-12-17 14:04:36 +11:00
parent 843a1133ef
commit ece46811f9
3 changed files with 12 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
module Spree
class ImageSerializer < ActiveModel::Serializer
attributes :id, :mini_url, :alt
end
end

View File

@@ -1,6 +1,6 @@
module Spree
class VariantSerializer < ActiveModel::Serializer
attributes :id, :is_master, :count_on_hand
attributes :id, :is_master, :count_on_hand, :options_text
has_many :images
end
end

View File

@@ -1,14 +1,17 @@
%products{"ng-controller" => "ProductsCtrl"}
%table
%thead
%th Item
%th{colspan: 2} Item
%th Description
%th Variant
%th QTY
%th Bulk
%th Price
%tr.product{"ng-repeat" => "product in data.products "}
%td {{ product.name }}
%td
%img{src: "{{ product.master.images[0].mini_url }}", alt: "{{product.master.images[0].alt}}"}
%td
{{ product.name }}
%td {{ product.description }}
%td {{ product.master.id }}
%td Quantity thing
@@ -18,5 +21,4 @@
%small from
$ {{ product.price }}
%pre {{ data.products | json }}