Split products by local/remote distributor: apply to products, search results and taxon pages

This commit is contained in:
Rohan Mitchell
2012-06-24 09:21:44 +10:00
parent ebb624bdc3
commit 34f95ffb4a
5 changed files with 56 additions and 12 deletions

View File

@@ -0,0 +1,10 @@
require 'open_food_web/split_products_by_distributor'
Spree::ProductsController.class_eval do
include Spree::DistributorsHelper
include OpenFoodWeb::SplitProductsByDistributor
respond_override :index => { :html => { :success => lambda {
@products, @products_local, @products_remote = split_products_by_distributor @products, current_distributor
} } }
end

View File

@@ -0,0 +1,10 @@
require 'open_food_web/split_products_by_distributor'
Spree::TaxonsController.class_eval do
include Spree::DistributorsHelper
include OpenFoodWeb::SplitProductsByDistributor
respond_override :show => { :html => { :success => lambda {
@products, @products_local, @products_remote = split_products_by_distributor @products, current_distributor
} } }
end

View File

@@ -1,4 +1,19 @@
Deface::Override.new(:virtual_path => "spree/home/index",
:replace => "[data-hook='homepage_products']",
:partial => "spree/shared/products_by_distributor",
:name => "products")
:name => "products_home")
Deface::Override.new(:virtual_path => "spree/products/index",
:replace => "[data-hook='homepage_products']",
:partial => "spree/shared/products_by_distributor",
:name => "products_products")
Deface::Override.new(:virtual_path => "spree/products/index",
:replace => "[data-hook='search_results']",
:partial => "spree/shared/products_by_distributor",
:name => "products_search")
Deface::Override.new(:virtual_path => "spree/taxons/show",
:replace => "[data-hook='taxon_products']",
:partial => "spree/shared/products_by_distributor",
:name => "products_taxon")

View File

@@ -1,5 +1,5 @@
- if @products
#products= render 'spree/shared/products', :products => @products
#products= render 'spree/shared/products', :products => @products, :taxon => @taxon
- else
#products-local= render 'spree/shared/products', :products => @products_local
#products-remote= render 'spree/shared/products', :products => @products_remote
#products-local= render 'spree/shared/products', :products => @products_local, :taxon => @taxon
#products-remote= render 'spree/shared/products', :products => @products_remote, :taxon => @taxon