From ec6805f573d5e010655532c065c697b3d2b2554d Mon Sep 17 00:00:00 2001 From: Rafael Schouten Date: Mon, 6 Oct 2014 23:51:19 +1100 Subject: [PATCH] use shared partial for no results --- app/views/home/_hubs.html.haml | 18 +++--------------- app/views/producers/index.html.haml | 22 +++------------------- 2 files changed, 6 insertions(+), 34 deletions(-) diff --git a/app/views/home/_hubs.html.haml b/app/views/home/_hubs.html.haml index c034747a7b..27aea75a7f 100644 --- a/app/views/home/_hubs.html.haml +++ b/app/views/home/_hubs.html.haml @@ -4,20 +4,13 @@ .small-12.columns %h1 Shop in your local area - #active-table-search.row.pad-top - .small-12.columns - %input{type: :text, - "ng-model" => "query", - placeholder: "Search by name or suburb...", - "ng-debounce" => "150", - "ofn-disable-enter" => true} - + = render partial: "shared/components/enterprise_search" = render partial: "home/filters" .row{bindonce: true} .small-12.columns .active_table - %hub.active_table_node.row.animate-repeat{"ng-repeat" => "hub in hubs = (Enterprises.hubs | searchEnterprises:query | taxons:activeTaxons | shipping:shippingTypes | showProfiles:show_profiles | orderBy:['-active', '+orders_close_at'])", + %hub.active_table_node.row.animate-repeat{"ng-repeat" => "hub in filteredEnterprises = (Enterprises.hubs | searchEnterprises:query | taxons:activeTaxons | shipping:shippingTypes | showHubProfiles:show_profiles | orderBy:['-active', '+orders_close_at'])", "ng-class" => "{'is_profile' : !hub.is_distributor, 'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}", "scroll-after-load" => true, "ng-controller" => "HubNodeCtrl", @@ -26,9 +19,4 @@ = render partial: 'home/skinny' = render partial: 'home/fat' - .row{"ng-show" => "hubs.length == 0"} - .columns.small-12 - %p.no-results - Sorry, no results found for - %strong {{query}}. - Try another search? + = render partial: 'shared/components/enterprise_no_results' diff --git a/app/views/producers/index.html.haml b/app/views/producers/index.html.haml index cf5bd4bed9..114e7d8459 100644 --- a/app/views/producers/index.html.haml +++ b/app/views/producers/index.html.haml @@ -3,20 +3,8 @@ .row .small-12.columns.pad-top %h1 Find local producers - / %div - / Find a - / %ofn-modal{title: "producer"} - / = render partial: "modals/producers" - / from the list below: - - #active-table-search.row - .small-12.columns - %input.animate-show{type: :text, - "ng-model" => "query", - placeholder: "Search by producer or suburb...", - "ng-debounce" => "150", - "ofn-disable-enter" => true} + = render partial: "shared/components/enterprise_search" = render partial: "producers/filters" .row{bindonce: true} @@ -24,7 +12,7 @@ .active_table %producer.active_table_node.row.animate-repeat{id: "{{producer.path}}", "scroll-after-load" => true, - "ng-repeat" => "producer in producers = (Enterprises.producers | searchEnterprises:query | taxons:activeTaxons)", + "ng-repeat" => "producer in filteredEnterprises = (Enterprises.producers | searchEnterprises:query | taxons:activeTaxons)", "ng-controller" => "ProducerNodeCtrl", "ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}", id: "{{producer.hash}}"} @@ -33,10 +21,6 @@ = render partial: 'producers/skinny' = render partial: 'producers/fat' - %producer.row{"ng-show" => "producers.length == 0"} - %p.no-results - Sorry, no results found for - %strong {{query}}. - Try another search? + = render partial: 'shared/components/enterprise_no_results' = render partial: "shared/footer"