mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-30 06:31:16 +00:00
Split results into name matches and distance matches
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
Darkswarm.filter 'enterpriseMatchesNameQuery', ->
|
||||
(enterprises, matches_name_query) ->
|
||||
enterprises.filter (enterprise) ->
|
||||
enterprise.matches_name_query == matches_name_query
|
||||
@@ -8,4 +8,10 @@
|
||||
= render "shared/components/enterprise_search"
|
||||
= render "home/filters"
|
||||
|
||||
= render "home/hubs_table", filters: "visible | taxons:activeTaxons | shipping:shippingTypes | showHubProfiles:show_profiles", order_by: "['-active', '-matches_name_query', '+distance', '+orders_close_at']"
|
||||
.row{bindonce: true}
|
||||
.small-12.columns
|
||||
%h2 Did you mean?
|
||||
= render "home/hubs_table", filters: "visible | enterpriseMatchesNameQuery:true | taxons:activeTaxons | shipping:shippingTypes | showHubProfiles:show_profiles", order_by: "['-active', '+distance', '+orders_close_at']"
|
||||
|
||||
%h2 Closest to {{ query }}...
|
||||
= render "home/hubs_table", filters: "visible | enterpriseMatchesNameQuery:false | taxons:activeTaxons | shipping:shippingTypes | showHubProfiles:show_profiles", order_by: "['-active', '+distance', '+orders_close_at']"
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
.row{bindonce: true}
|
||||
.small-12.columns
|
||||
.active_table
|
||||
%hub.active_table_node.row.animate-repeat{"ng-repeat" => "hub in filteredEnterprises = (Enterprises.hubs | #{filters} | orderBy:#{order_by})",
|
||||
"ng-class" => "{'is_profile' : hub.category == 'hub_profile', 'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}",
|
||||
"ng-controller" => "HubNodeCtrl",
|
||||
id: "{{hub.hash}}"}
|
||||
.small-12.columns
|
||||
= render partial: 'home/skinny'
|
||||
= render partial: 'home/fat'
|
||||
.active_table
|
||||
%hub.active_table_node.row.animate-repeat{"ng-repeat" => "hub in filteredEnterprises = (Enterprises.hubs | #{filters} | orderBy:#{order_by})",
|
||||
"ng-class" => "{'is_profile' : hub.category == 'hub_profile', 'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}",
|
||||
"ng-controller" => "HubNodeCtrl",
|
||||
id: "{{hub.hash}}"}
|
||||
.small-12.columns
|
||||
= render partial: 'home/skinny'
|
||||
= render partial: 'home/fat'
|
||||
|
||||
= render partial: 'shared/components/enterprise_no_results'
|
||||
= render partial: 'shared/components/enterprise_no_results'
|
||||
|
||||
Reference in New Issue
Block a user