mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Move distributor lookup code into current_distributor helper
This commit is contained in:
7
app/helpers/spree/distributors_helper.rb
Normal file
7
app/helpers/spree/distributors_helper.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
module Spree
|
||||
module DistributorsHelper
|
||||
def current_distributor
|
||||
@current_distributor ||= current_order(false).andand.distributor
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -4,7 +4,6 @@
|
||||
%li#link-to-cart{'data-hook' => ''}
|
||||
= link_to_cart
|
||||
|
||||
- order = current_order(false)
|
||||
- if order.andand.distributor
|
||||
- if current_distributor
|
||||
%li#current-distributor{'data-hook' => ''}
|
||||
= "You are shopping at #{order.distributor.name}"
|
||||
= "You are shopping at #{current_distributor.name}"
|
||||
|
||||
Reference in New Issue
Block a user