mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-15 04:14:24 +00:00
Test selecting distributor when adding item to cart, for no/remote distributor selected
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user