mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Rename API field properties to supplied_properties
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Darkswarm.filter 'properties', ()->
|
||||
# Filter anything that responds to object.properties
|
||||
Darkswarm.filter 'properties', ->
|
||||
# Filter anything that responds to object.supplied_properties
|
||||
(objects, ids) ->
|
||||
objects ||= []
|
||||
ids ?= []
|
||||
@@ -7,10 +7,6 @@ Darkswarm.filter 'properties', ()->
|
||||
# No properties selected, pass all objects through.
|
||||
objects
|
||||
else
|
||||
objects.filter (obj)->
|
||||
properties = obj.properties
|
||||
# Combine object properties with supplied properties, if they exist.
|
||||
# properties = properties.concat obj.supplied_properties if obj.supplied_properties
|
||||
# Match property array.
|
||||
properties.some (property)->
|
||||
objects.filter (obj) ->
|
||||
obj.supplied_properties.some (property) ->
|
||||
property.id in ids
|
||||
|
||||
@@ -2,6 +2,6 @@ Darkswarm.filter 'propertiesOf', ->
|
||||
(objects)->
|
||||
properties = {}
|
||||
for object in objects
|
||||
for property in object.properties
|
||||
for property in object.supplied_properties
|
||||
properties[property.id] = property
|
||||
properties
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
%span.filter-shopfront.property-selectors.pad-top
|
||||
%ul.inline-block
|
||||
%li{"ng-repeat" => "property in enterprise.properties"}
|
||||
%li{"ng-repeat" => "property in enterprise.supplied_properties"}
|
||||
%a.button.tiny{"ng-bind" => "property.presentation"}
|
||||
|
||||
.about-container.pad-top
|
||||
|
||||
@@ -21,7 +21,7 @@ end
|
||||
|
||||
class Api::UncachedEnterpriseSerializer < ActiveModel::Serializer
|
||||
attributes :orders_close_at, :active
|
||||
has_many :properties, serializer: Api::PropertySerializer
|
||||
has_many :supplied_properties, serializer: Api::PropertySerializer
|
||||
|
||||
def orders_close_at
|
||||
options[:data].earliest_closing_times[object.id]
|
||||
@@ -31,7 +31,7 @@ class Api::UncachedEnterpriseSerializer < ActiveModel::Serializer
|
||||
options[:data].active_distributors.andand.include? object
|
||||
end
|
||||
|
||||
def properties
|
||||
def supplied_properties
|
||||
# This results in 3 queries per enterprise
|
||||
product_properties = Spree::Property.applied_by(object)
|
||||
producer_properties = object.properties
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
%render-svg{path: "{{taxon.icon}}"}
|
||||
%span{"ng-bind" => "::taxon.name"}
|
||||
%div
|
||||
%span.fat-properties{"ng-repeat" => "property in producer.properties"}
|
||||
%span.fat-properties{"ng-repeat" => "property in producer.supplied_properties"}
|
||||
%span{"ng-bind" => "property.presentation"}
|
||||
|
||||
%div.show-for-medium-up{"ng-if" => "producer.supplied_taxons.length==0"}
|
||||
|
||||
Reference in New Issue
Block a user