Test selecting distributor when adding item to cart, for no/remote distributor selected

This commit is contained in:
Rohan Mitchell
2012-06-24 11:41:10 +10:00
parent a91722a593
commit b2f5e23fa4
3 changed files with 31 additions and 9 deletions

View File

@@ -4,15 +4,8 @@ Spree::ProductsController.class_eval do
include Spree::DistributorsHelper
include OpenFoodWeb::SplitProductsByDistributor
before_filter :load_distributors, :only => :show
respond_override :index => { :html => { :success => lambda {
@products, @products_local, @products_remote = split_products_by_distributor @products, current_distributor
} } }
def load_distributors
@distributors = Spree::Distributor.by_name
end
end

View File

@@ -3,7 +3,7 @@
%p Quantity
= number_field_tag (@product.has_variants? ? :quantity : "variants[#{@product.master.id}]"), 1, :class => 'title', :in => 1..@product.on_hand
%p Distributor
= select_tag "distributor_id", options_from_collection_for_select(@distributors, "id", "name", current_distributor.andand.id)
= select_tag "distributor_id", options_from_collection_for_select(@product.distributors, "id", "name", current_distributor.andand.id)
%br/
= button_tag :class => 'large primary', :id => 'add-to-cart-button', :type => :submit do
= t(:add_to_cart)