From 094485bc2d0b395f689da4179f5047ee3741346f Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 31 Oct 2013 15:52:22 +1100 Subject: [PATCH] Sort enterprises by name, display direct-from-the-farm links separately at top --- app/controllers/enterprises_controller.rb | 2 +- app/views/enterprises/show.html.haml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb index 4b2e0983d1..5820fa5124 100644 --- a/app/controllers/enterprises_controller.rb +++ b/app/controllers/enterprises_controller.rb @@ -41,7 +41,7 @@ class EnterprisesController < BaseController @products = [] if @enterprise.is_primary_producer - @distributors = Enterprise.distributing_any_product_of(@enterprise.supplied_products) + @distributors = Enterprise.distributing_any_product_of(@enterprise.supplied_products).by_name.all end if current_order_cycle diff --git a/app/views/enterprises/show.html.haml b/app/views/enterprises/show.html.haml index 9c42953079..305f294a81 100644 --- a/app/views/enterprises/show.html.haml +++ b/app/views/enterprises/show.html.haml @@ -11,5 +11,8 @@ %p.hint Select a hub to start shopping: %ul#supplier-distributors + - if @distributors.delete @enterprise + %li= link_to "Buy direct from the farm", shop_enterprise_path(@enterprise), {class: temp_landing_page_distributor_link_class(@enterprise)} + - @distributors.each do |distributor| %li= link_to distributor.name, shop_enterprise_path(distributor), {class: temp_landing_page_distributor_link_class(distributor)}