Adding price to serializer

This commit is contained in:
Will Marshall
2013-12-17 15:45:06 +11:00
parent 67fcf0f534
commit 7ea9cf6862
3 changed files with 28 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
module Spree
class ProductSerializer < ActiveModel::Serializer
attributes :id, :name, :description
attributes :id, :name, :description, :price
has_one :master
end

View File

@@ -1,23 +1,30 @@
%products{"ng-controller" => "ProductsCtrl"}
%table
%thead
%th{colspan: 2} Item
%th Description
%th Variant
%th QTY
%th Bulk
%th Price
%tr.product{"ng-repeat" => "product in data.products "}
%td
%td
{{ product.name }}
%td {{ product.description }}
%td {{ product.master.id }}
%td Quantity thing
%td.group_buy{"ng-class" => "{enabled: product.group_buy}"}
Not available
%td.price
%small from
$ {{ product.price }}
%form.custom
%table
%thead
%th{colspan: 2} Item
%th Description
%th Variant
%th QTY
%th Bulk
%th Price
%tr.product{"ng-repeat" => "product in data.products "}
%td
{{ product.master.images[0].mini_url }}
{{product.master.images[0].alt}}
%td
{{ product.name }}
%td {{ product.description }}
%td {{ product.master.options_text }}
%td
%input{type: :number, id: "quantity_product_{{product.id}}"}
%td.group_buy
%span{"ng-show" => "{enabled: product.group_buy}"}
Available
%span{"ng-hide" => "{enabled: product.group_buy}"}
Not available
%td.price
%small from
$ {{ product.price }}
%pre {{ data.products | json }}

View File

@@ -49,7 +49,6 @@ feature "As a consumer I want to shop with a distributor", js: true do
before do
exchange = Exchange.find(oc1.exchanges.to_enterprises(distributor).outgoing.first.id)
exchange.variants << product.master
visit shop_path
end
@@ -68,9 +67,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
select "frogs", :from => "order_cycle_id"
page.should have_content product.name
end
end
end
context "when no order cycles are available" do
@@ -89,7 +86,6 @@ feature "As a consumer I want to shop with a distributor", js: true do
page.should have_content "The next cycle opens in 10 days"
end
end
end
end
end