mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Adding price to serializer
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module Spree
|
||||
class ProductSerializer < ActiveModel::Serializer
|
||||
attributes :id, :name, :description
|
||||
attributes :id, :name, :description, :price
|
||||
|
||||
has_one :master
|
||||
end
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user