diff --git a/app/assets/javascripts/darkswarm/filters/filter_hubs.js.coffee b/app/assets/javascripts/darkswarm/filters/filter_hubs.js.coffee deleted file mode 100644 index b6adb84508..0000000000 --- a/app/assets/javascripts/darkswarm/filters/filter_hubs.js.coffee +++ /dev/null @@ -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 diff --git a/app/assets/javascripts/darkswarm/filters/filter_producers.js.coffee b/app/assets/javascripts/darkswarm/filters/filter_producers.js.coffee deleted file mode 100644 index ed5b8c1bea..0000000000 --- a/app/assets/javascripts/darkswarm/filters/filter_producers.js.coffee +++ /dev/null @@ -1,6 +0,0 @@ -Darkswarm.filter 'filterProducers', (hubsFilter)-> - (producers, text) -> - producers ||= [] - text ?= "" - hubsFilter(producers, text) - diff --git a/app/assets/javascripts/darkswarm/filters/search_enterprises.js.coffee b/app/assets/javascripts/darkswarm/filters/search_enterprises.js.coffee new file mode 100644 index 0000000000..20d0fd91c9 --- /dev/null +++ b/app/assets/javascripts/darkswarm/filters/search_enterprises.js.coffee @@ -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 diff --git a/app/views/home/_hubs.html.haml b/app/views/home/_hubs.html.haml index 24e4b037ba..b7a14fc7bf 100644 --- a/app/views/home/_hubs.html.haml +++ b/app/views/home/_hubs.html.haml @@ -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", diff --git a/app/views/producers/index.html.haml b/app/views/producers/index.html.haml index cba8011caf..095cff2a11 100644 --- a/app/views/producers/index.html.haml +++ b/app/views/producers/index.html.haml @@ -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}}"}