mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-15 23:57:48 +00:00
Reworking the top details so it works in all pages
This commit is contained in:
@@ -5,9 +5,6 @@ class Shop::ShopController < BaseController
|
||||
before_filter :set_order_cycles
|
||||
|
||||
def show
|
||||
# All suppliers of all our products
|
||||
@producers = Exchange.where(receiver_id: @distributor.id).map{ |ex| ex.variants.map {|v| v.product.supplier }}.flatten.uniq
|
||||
@groups = current_distributor.groups
|
||||
end
|
||||
|
||||
def products
|
||||
|
||||
@@ -8,5 +8,10 @@ module SharedHelper
|
||||
klass += @active_distributors.include?(distributor) ? ' active' : ' inactive'
|
||||
klass
|
||||
end
|
||||
|
||||
# all suppliers of current distributor's products
|
||||
def current_producers
|
||||
Exchange.where(receiver_id: current_distributor.id).map{ |ex| ex.variants.map {|v| v.product.supplier }}.flatten.uniq
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
= render partial: "shop/modals"
|
||||
|
||||
%navigation
|
||||
%distributor.details.row
|
||||
#distributor_title
|
||||
@@ -9,3 +11,5 @@
|
||||
%a{href: "/"} Change location
|
||||
|
||||
= render partial: "shop/shop/order_cycles"
|
||||
|
||||
= render partial: "shop/tabs"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- for producer in @producers
|
||||
- for producer in current_producers
|
||||
.reveal-modal{id: "producer_details_#{producer.id}"}
|
||||
.row
|
||||
- if producer.logo.exists?
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
|
||||
- for group in @groups
|
||||
- for group in current_distributor.groups
|
||||
- for sibling in group.enterprises.except(current_distributor)
|
||||
.reveal-modal{id: "sibling_details_#{sibling.id}"}
|
||||
.row
|
||||
7
app/views/shop/_tabs.html.haml
Normal file
7
app/views/shop/_tabs.html.haml
Normal file
@@ -0,0 +1,7 @@
|
||||
%tabs
|
||||
.row
|
||||
.section-container.auto{"data-section" => "", "data-options" => "one_up: false"}
|
||||
= render 'shop/shop/about_us'
|
||||
= render 'shop/shop/producers'
|
||||
= render 'shop/shop/groups'
|
||||
= render 'shop/shop/contact'
|
||||
@@ -3,8 +3,8 @@
|
||||
%a{href: "#about"} About Us
|
||||
|
||||
.content{"data-section-content" => ""}
|
||||
%img.about.right{src: @distributor.promo_image.url(:large)}
|
||||
%p= @distributor.long_description.andand.html_safe
|
||||
%img.about.right{src: current_distributor.promo_image.url(:large)}
|
||||
%p= current_distributor.long_description.andand.html_safe
|
||||
|
||||
-#.panel
|
||||
-#= @distributor.distributor_info.andand.html_safe
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
.panel
|
||||
%p
|
||||
%strong E
|
||||
%a{href: "mailto:#{@distributor.email}"}= @distributor.email
|
||||
- unless @distributor.website.blank?
|
||||
%a{href: "mailto:#{current_distributor.email}"}= current_distributor.email
|
||||
- unless current_distributor.website.blank?
|
||||
%br
|
||||
%strong W
|
||||
%a{href: @distributor.website}= @distributor.website
|
||||
%a{href: current_distributor.website}= current_distributor.website
|
||||
%br
|
||||
= [@distributor.address.address1, @distributor.address.address2].join ", "
|
||||
= [current_distributor.address.address1, current_distributor.address.address2].join ", "
|
||||
%br
|
||||
= @distributor.address.city
|
||||
= @distributor.address.state
|
||||
= @distributor.address.zipcode
|
||||
= current_distributor.address.city
|
||||
= current_distributor.address.state
|
||||
= current_distributor.address.zipcode
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
%a{href: "#groups"} Our Groups
|
||||
.content{"data-section-content" => ""}
|
||||
%ul
|
||||
- for group in @groups
|
||||
- for group in current_distributor.groups
|
||||
%li
|
||||
%h4= group.name
|
||||
%ul
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
%a{href: "#producers"} Our Producers
|
||||
.content{"data-section-content" => ""}
|
||||
%ul
|
||||
- for producer in @producers
|
||||
- for producer in current_producers
|
||||
%li
|
||||
%a{"data-reveal-id" => "producer_details_#{producer.id}"}
|
||||
= producer.name
|
||||
|
||||
@@ -11,18 +11,5 @@
|
||||
%strong {{ order_cycle.orders_close_at | date_in_words }}
|
||||
= render partial: "shop/details"
|
||||
|
||||
-# This partial generates the producer and group sibling modals
|
||||
= render partial: "shop/shop/modals"
|
||||
|
||||
%tabs
|
||||
.row
|
||||
.section-container.auto{"data-section" => "", "data-options" => "one_up: false"}
|
||||
|
||||
= render 'shop/shop/about_us'
|
||||
= render 'shop/shop/producers'
|
||||
= render 'shop/shop/groups'
|
||||
= render 'shop/shop/contact'
|
||||
|
||||
|
||||
%products.row
|
||||
= render partial: "shop/shop/products"
|
||||
|
||||
Reference in New Issue
Block a user