mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-15 23:57:48 +00:00
Removing all the old order populator stuff
This commit is contained in:
BIN
app/assets/images/matte.png
Normal file
BIN
app/assets/images/matte.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
20
app/assets/javascripts/darkswarm/overrides.js.coffee
Normal file
20
app/assets/javascripts/darkswarm/overrides.js.coffee
Normal file
@@ -0,0 +1,20 @@
|
||||
Foundation.libs.section.toggle_active = (e)->
|
||||
$this = $(this)
|
||||
self = Foundation.libs.section
|
||||
region = $this.parent()
|
||||
content = $this.siblings(self.settings.content_selector)
|
||||
section = region.parent()
|
||||
settings = $.extend({}, self.settings, self.data_options(section))
|
||||
prev_active_region = section.children(self.settings.region_selector).filter("." + self.settings.active_class)
|
||||
|
||||
#for anchors inside [data-section-title]
|
||||
e.preventDefault() if not settings.deep_linking and content.length > 0
|
||||
e.stopPropagation() #do not catch same click again on parent
|
||||
unless region.hasClass(self.settings.active_class)
|
||||
prev_active_region.removeClass self.settings.active_class
|
||||
region.addClass self.settings.active_class
|
||||
#force resize for better performance (do not wait timer)
|
||||
self.resize region.find(self.settings.section_selector).not("[" + self.settings.resized_data_attr + "]"), true
|
||||
else if not settings.one_up# and (self.small(section) or self.is_vertical_nav(section) or self.is_horizontal_nav(section) or self.is_accordion(section))
|
||||
region.removeClass self.settings.active_class
|
||||
settings.callback section
|
||||
@@ -5,6 +5,8 @@ class 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
|
||||
end
|
||||
|
||||
def products
|
||||
|
||||
@@ -2,4 +2,4 @@ class SuburbsController < ActionController::Base
|
||||
def index
|
||||
@suburbs = Suburb.matching(params[:term]).order(:name).limit(8)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
%tbody{"ng-repeat" => "product in data.products "}
|
||||
%tr.product
|
||||
%td
|
||||
%img{src: "{{ product.master.images[0].small_url }}"}
|
||||
-#%img{src: "{{ product.master.images[0].small_url }}"}
|
||||
-#{{product.master.images[0].alt}}
|
||||
%td
|
||||
%h5
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
%h4
|
||||
= @distributor.name
|
||||
%location= @distributor.address.city
|
||||
%small Change location
|
||||
%small
|
||||
%a{href: "/"} Change location
|
||||
= render partial: "shop/order_cycles"
|
||||
|
||||
-#%description
|
||||
@@ -23,7 +24,9 @@
|
||||
%p.title.avenir{"data-section-title" => ""}
|
||||
%a{href: "#producers"} Our Producers
|
||||
.content{"data-section-content" => ""}
|
||||
%p Content of section 2.
|
||||
%ul
|
||||
- for producer in @producers
|
||||
%li= producer.name
|
||||
|
||||
%section
|
||||
%p.title.avenir{"data-section-title" => ""}
|
||||
|
||||
@@ -8,6 +8,7 @@ describe ShopController do
|
||||
response.should redirect_to root_path
|
||||
end
|
||||
|
||||
|
||||
describe "with a distributor in place" do
|
||||
before do
|
||||
controller.stub(:current_distributor).and_return d
|
||||
@@ -56,6 +57,22 @@ describe ShopController do
|
||||
end
|
||||
|
||||
|
||||
describe "producers/suppliers" do
|
||||
let(:supplier) { create(:supplier_enterprise) }
|
||||
let(:product) { create(:product, supplier: supplier) }
|
||||
let(:order_cycle) { create(:order_cycle, distributors: [d], coordinator: create(:distributor_enterprise)) }
|
||||
|
||||
before do
|
||||
exchange = Exchange.find(order_cycle.exchanges.to_enterprises(d).outgoing.first.id)
|
||||
exchange.variants << product.master
|
||||
end
|
||||
|
||||
it "builds a list of producers/suppliers" do
|
||||
spree_get :show
|
||||
assigns[:producers].should == [supplier]
|
||||
end
|
||||
end
|
||||
|
||||
describe "returning products" do
|
||||
let(:product) { create(:product) }
|
||||
let(:order_cycle) { create(:order_cycle, distributors: [d], coordinator: create(:distributor_enterprise)) }
|
||||
|
||||
@@ -17,6 +17,25 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
page.should have_text distributor.name
|
||||
end
|
||||
|
||||
describe "With products in order cycles" do
|
||||
let(:supplier) { create(:supplier_enterprise) }
|
||||
let(:product) { create(:product, supplier: supplier) }
|
||||
let(:order_cycle) { create(:order_cycle, distributors: [distributor], coordinator: create(:distributor_enterprise)) }
|
||||
|
||||
before do
|
||||
exchange = Exchange.find(order_cycle.exchanges.to_enterprises(distributor).outgoing.first.id)
|
||||
exchange.variants << product.master
|
||||
end
|
||||
|
||||
it "shows the suppliers/producers for a distributor" do
|
||||
visit shop_path
|
||||
click_link "Our Producers"
|
||||
page.should have_content supplier.name
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
describe "selecting an order cycle" do
|
||||
it "selects an order cycle if only one is open" do
|
||||
# create order cycle
|
||||
|
||||
Reference in New Issue
Block a user