Reworking the top details so it works in all pages

This commit is contained in:
Will Marshall
2014-03-14 17:06:03 +11:00
parent ac78ab91fe
commit 0cc108206b
10 changed files with 29 additions and 29 deletions

View File

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

View File

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

View File

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

View File

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

View 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'

View File

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

View File

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

View File

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

View File

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

View File

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