Sort enterprises by name, display direct-from-the-farm links separately at top

This commit is contained in:
Rohan Mitchell
2013-10-31 15:52:22 +11:00
parent eb997c94a2
commit 094485bc2d
2 changed files with 4 additions and 1 deletions

View File

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

View File

@@ -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)}