generalise search filter to any enterprise

This commit is contained in:
Rafael Schouten
2014-09-25 11:34:49 +10:00
parent da620f3723
commit 3775cd29cb
5 changed files with 11 additions and 17 deletions

View File

@@ -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

View File

@@ -1,6 +0,0 @@
Darkswarm.filter 'filterProducers', (hubsFilter)->
(producers, text) ->
producers ||= []
text ?= ""
hubsFilter(producers, text)

View File

@@ -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

View File

@@ -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",

View File

@@ -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}}"}