Split results into name matches and distance matches

This commit is contained in:
Rohan Mitchell
2015-07-02 15:31:26 +10:00
parent 97c9504344
commit 7fd4815904
3 changed files with 20 additions and 12 deletions

View File

@@ -0,0 +1,4 @@
Darkswarm.filter 'enterpriseMatchesNameQuery', ->
(enterprises, matches_name_query) ->
enterprises.filter (enterprise) ->
enterprise.matches_name_query == matches_name_query

View File

@@ -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']"

View File

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