mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
Display distributor details on product page when distributor is selected
This commit is contained in:
@@ -145,8 +145,11 @@ ul.product-listing {
|
||||
|
||||
|
||||
/* Distributor details on product details page */
|
||||
#product-distributor-details {
|
||||
fieldset#product-distributor-details {
|
||||
float: right;
|
||||
margin-top: 0;
|
||||
width: 250px;
|
||||
@extend #shipping;
|
||||
}
|
||||
|
||||
#product-variants {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Deface::Override.new(:virtual_path => "spree/products/show",
|
||||
:insert_before => "[data-hook='cart_form']",
|
||||
:partial => "distributors/details",
|
||||
:partial => "spree/products/distributor_details",
|
||||
:name => "product_distributor_details")
|
||||
|
||||
@@ -1,2 +1,23 @@
|
||||
#product-distributor-details.columns.five.omega
|
||||
When you select a distributor for your order, their address and pickup times will be displayed here.
|
||||
%h2= distributor.name
|
||||
%p
|
||||
%strong Address:
|
||||
%br/
|
||||
= render 'spree/shared/address', :address => distributor.pickup_address
|
||||
%p
|
||||
%strong Next collection time:
|
||||
%br/
|
||||
= distributor.next_collection_at
|
||||
%p
|
||||
%strong Regular collection times:
|
||||
%br/
|
||||
= distributor.pickup_times
|
||||
%p
|
||||
%strong Contact:
|
||||
%br/
|
||||
= distributor.contact
|
||||
%br/
|
||||
= "Phone: #{distributor.phone}"
|
||||
%br/
|
||||
= "Email: #{distributor.email}"
|
||||
%p= distributor.description
|
||||
%p= link_to distributor.url, distributor.url if distributor.url
|
||||
|
||||
@@ -1,27 +1,4 @@
|
||||
.columns.omega.six
|
||||
%fieldset#shipping
|
||||
%legend Distributor
|
||||
%h2= @order.distributor.name
|
||||
%p
|
||||
%strong Address:
|
||||
%br/
|
||||
= render 'spree/shared/address', :address => @order.distributor.pickup_address
|
||||
%p
|
||||
%strong Next collection time:
|
||||
%br/
|
||||
= @order.distributor.next_collection_at
|
||||
%p
|
||||
%strong Regular collection times:
|
||||
%br/
|
||||
= @order.distributor.pickup_times
|
||||
%p
|
||||
%strong Contact:
|
||||
%br/
|
||||
= @order.distributor.contact
|
||||
%br/
|
||||
= "Phone: #{@order.distributor.phone}"
|
||||
%br/
|
||||
= "Email: #{@order.distributor.email}"
|
||||
%p= @order.distributor.description
|
||||
%p= link_to @order.distributor.url, @order.distributor.url if @order.distributor.url
|
||||
|
||||
= render 'distributors/details', :distributor => @order.distributor
|
||||
|
||||
7
app/views/spree/products/_distributor_details.html.haml
Normal file
7
app/views/spree/products/_distributor_details.html.haml
Normal file
@@ -0,0 +1,7 @@
|
||||
%fieldset#product-distributor-details.columns.five.omega
|
||||
%legend Distributor
|
||||
- order = current_order(false)
|
||||
- if order.andand.distributor.present?
|
||||
= render 'distributors/details', :distributor => order.distributor
|
||||
- else
|
||||
When you select a distributor for your order, their address and pickup times will be displayed here.
|
||||
@@ -32,7 +32,33 @@ feature %q{
|
||||
page.should have_selector '#product-distributor-details', :text => 'When you select a distributor for your order, their address and pickup times will be displayed here.'
|
||||
end
|
||||
|
||||
it "displays distributor details when one is selected"
|
||||
it "displays distributor details when one is selected" do
|
||||
d = create(:distributor)
|
||||
p = create(:product, :distributors => [d])
|
||||
|
||||
visit spree.root_path
|
||||
click_link d.name
|
||||
visit spree.product_path p
|
||||
|
||||
within '#product-distributor-details' do
|
||||
[d.name,
|
||||
d.pickup_address.address1,
|
||||
d.pickup_address.city,
|
||||
d.pickup_address.zipcode,
|
||||
d.pickup_address.state_text,
|
||||
d.pickup_address.country.name,
|
||||
d.pickup_times,
|
||||
d.next_collection_at,
|
||||
d.contact,
|
||||
d.phone,
|
||||
d.email,
|
||||
d.description,
|
||||
d.url].each do |value|
|
||||
|
||||
page.should have_content value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with Javascript" do
|
||||
|
||||
Reference in New Issue
Block a user