mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
generalise search filter to any enterprise
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
Darkswarm.filter 'hubs', (Matcher)->
|
||||
(hubs, text) ->
|
||||
hubs ||= []
|
||||
text ?= ""
|
||||
|
||||
hubs.filter (hub)=>
|
||||
Matcher.match [
|
||||
hub.name, hub.address.zipcode, hub.address.city, hub.address.state
|
||||
], text
|
||||
@@ -1,6 +0,0 @@
|
||||
Darkswarm.filter 'filterProducers', (hubsFilter)->
|
||||
(producers, text) ->
|
||||
producers ||= []
|
||||
text ?= ""
|
||||
hubsFilter(producers, text)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Darkswarm.filter 'searchEnterprises', (Matcher)->
|
||||
(enterprises, text) ->
|
||||
enterprises ||= []
|
||||
text ?= ""
|
||||
|
||||
enterprises.filter (enterprise)=>
|
||||
Matcher.match [
|
||||
enterprise.name, enterprise.address.zipcode, enterprise.address.city, enterprise.address.state
|
||||
], text
|
||||
@@ -17,7 +17,7 @@
|
||||
.row{bindonce: true}
|
||||
.small-12.columns
|
||||
.active_table
|
||||
%hub.active_table_node.row.animate-repeat{"ng-repeat" => "hub in filteredHubs = (hubs | hubs:query | taxons:activeTaxons | shipping:shippingTypes | showProfiles:show_profiles )",
|
||||
%hub.active_table_node.row.animate-repeat{"ng-repeat" => "hub in filteredHubs = (hubs | searchEnterprises:query | taxons:activeTaxons | shipping:shippingTypes | showProfiles:show_profiles )",
|
||||
"ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}",
|
||||
"scroll-after-load" => true,
|
||||
"ng-controller" => "HubNodeCtrl",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
.active_table
|
||||
%producer.active_table_node.row.animate-repeat{id: "{{producer.path}}",
|
||||
"scroll-after-load" => true,
|
||||
"ng-repeat" => "producer in producers = (Producers.visible | showProfiles:show_profiles | filterProducers:query | taxons:activeTaxons)",
|
||||
"ng-repeat" => "producer in producers = (Producers.visible | showProfiles:show_profiles | searchEnterprises:query | taxons:activeTaxons)",
|
||||
"ng-controller" => "ProducerNodeCtrl",
|
||||
"ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}",
|
||||
id: "{{producer.hash}}"}
|
||||
|
||||
Reference in New Issue
Block a user