mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-09 23:06:06 +00:00
Adding distributors display to producers page
This commit is contained in:
@@ -141,7 +141,7 @@ class Enterprise < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def suppliers
|
||||
self.relatives.is_supplier
|
||||
self.relatives.is_primary_producer
|
||||
end
|
||||
|
||||
def distributed_variants
|
||||
|
||||
@@ -5,11 +5,8 @@ child distributed_taxons: :taxons do
|
||||
attributes :name, :id
|
||||
end
|
||||
|
||||
child producers: :producers do
|
||||
child suppliers: :producers do
|
||||
attributes :name, :id
|
||||
node :path do |producer|
|
||||
producer_path(producer_path)
|
||||
end
|
||||
end
|
||||
|
||||
node :pickup do |hub|
|
||||
|
||||
@@ -8,7 +8,7 @@ end
|
||||
child distributors: :distributors do
|
||||
attributes :name, :id
|
||||
node :path do |distributor|
|
||||
distributor_path(distributor)
|
||||
shop_enterprise_path(distributor)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -5,9 +5,13 @@
|
||||
{{ producer.taxons | printArrayOfObjects }}
|
||||
.columns.small-4
|
||||
%strong About us
|
||||
{{ producer.description }}
|
||||
%p.trans-sentence
|
||||
{{ producer.description }}
|
||||
.columns.small-4
|
||||
%strong Our distributors
|
||||
%ul
|
||||
%li{"ng-repeat" => "distributor in producer.distributors"}
|
||||
%a{"bo-href" => "distributor.path"}{{ distributor.name }}
|
||||
|
||||
.row.active_table_row.link{"ng-show" => "open()", "ng-repeat" => "hub in producer.hubs"}
|
||||
.columns.small-11
|
||||
|
||||
@@ -47,7 +47,7 @@ describe Enterprise do
|
||||
|
||||
it "scopes relatives to producers" do
|
||||
e.should_receive(:relatives).and_return(relatives = [])
|
||||
relatives.should_receive(:is_supplier)
|
||||
relatives.should_receive(:is_primary_producer)
|
||||
e.suppliers
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user