Move distributor lookup code into current_distributor helper

This commit is contained in:
Rohan Mitchell
2012-06-22 11:48:39 +10:00
parent 4911a06c9d
commit 0c5162f9fb
2 changed files with 9 additions and 3 deletions

View File

@@ -0,0 +1,7 @@
module Spree
module DistributorsHelper
def current_distributor
@current_distributor ||= current_order(false).andand.distributor
end
end
end

View File

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