mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Renaming everything to Shop
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
# More info at https://github.com/guard/guard#readme
|
||||
|
||||
guard 'livereload' do
|
||||
#watch(%r{app/views/.+\.(erb|haml|slim)$})
|
||||
#watch(%r{app/helpers/.+\.rb})
|
||||
watch(%r{app/views/.+\.(erb|haml|slim)$})
|
||||
watch(%r{app/helpers/.+\.rb})
|
||||
watch(%r{public/.+\.(css|js|html)})
|
||||
#watch(%r{config/locales/.+\.yml})
|
||||
# Rails Assets Pipeline
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
class DistributorsController < ApplicationController
|
||||
layout "darkswarm"
|
||||
end
|
||||
9
app/controllers/shop_controller.rb
Normal file
9
app/controllers/shop_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class ShopController < BaseController
|
||||
layout "darkswarm"
|
||||
|
||||
def index
|
||||
@distributor = current_distributor
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module DistributorsHelper
|
||||
end
|
||||
3
app/helpers/shop_helper.rb
Normal file
3
app/helpers/shop_helper.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
module ShopHelper
|
||||
|
||||
end
|
||||
1
app/views/enterprises/_about_us.html.haml
Normal file
1
app/views/enterprises/_about_us.html.haml
Normal file
@@ -0,0 +1 @@
|
||||
About Us
|
||||
1
app/views/enterprises/_contact_us.html.haml
Normal file
1
app/views/enterprises/_contact_us.html.haml
Normal file
@@ -0,0 +1 @@
|
||||
Contact Us
|
||||
13
app/views/products/_list.html.haml
Normal file
13
app/views/products/_list.html.haml
Normal file
@@ -0,0 +1,13 @@
|
||||
%table#product-list
|
||||
%thead
|
||||
%th Item
|
||||
%th Description
|
||||
%th Variant
|
||||
%th Quantity
|
||||
%th Available?
|
||||
%th Price
|
||||
|
||||
- list.each do |product|
|
||||
%tr
|
||||
%td= product.name
|
||||
%td= product.description
|
||||
10
app/views/shop/index.html.haml
Normal file
10
app/views/shop/index.html.haml
Normal file
@@ -0,0 +1,10 @@
|
||||
= @distributor.name
|
||||
|
||||
%description
|
||||
= @distributor.long_description.andand.html_safe
|
||||
|
||||
|
||||
|
||||
= render partial: "enterprises/contact_us"
|
||||
= render partial: "enterprises/about_us"
|
||||
|
||||
@@ -2,6 +2,8 @@ Openfoodnetwork::Application.routes.draw do
|
||||
root :to => 'home#temp_landing_page'
|
||||
|
||||
|
||||
resources :shop
|
||||
|
||||
resources :enterprises do
|
||||
collection do
|
||||
get :suppliers
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe DistributorsController do
|
||||
|
||||
end
|
||||
7
spec/controllers/shop_controller_spec.rb
Normal file
7
spec/controllers/shop_controller_spec.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe DistributorsController do
|
||||
it "should set the distributor when loading show"
|
||||
|
||||
it "should create/load an order when loading show"
|
||||
end
|
||||
43
spec/features/consumer/shopping_spec.rb
Normal file
43
spec/features/consumer/shopping_spec.rb
Normal file
@@ -0,0 +1,43 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature "As a consumer I want to shop with a distributor" do
|
||||
include AuthenticationWorkflow
|
||||
include WebHelper
|
||||
|
||||
describe "Viewing a distributor" do
|
||||
let(:distributor) { create(:distributor_enterprise) }
|
||||
|
||||
before do #temporarily using the old way to select distributor
|
||||
create_enterprise_group_for distributor
|
||||
visit "/"
|
||||
click_link distributor.name
|
||||
end
|
||||
it "shows a distributor" do
|
||||
visit shop_index_path
|
||||
page.should have_text distributor.name
|
||||
end
|
||||
|
||||
describe "selecting an order cycle" do
|
||||
it "selects an order cycle if only one is open" do
|
||||
# create order cycle
|
||||
oc1 = create(:simple_order_cycle, name: 'oc 1', distributors: [distributor])
|
||||
exchange = Exchange.find(oc1.exchanges.to_enterprises(d).outgoing.first.id)
|
||||
exchange.update_attribute :pickup_time, "turtles"
|
||||
|
||||
visit shop_index_path
|
||||
page.should have_selector "option[selected]", text: 'Packing'
|
||||
|
||||
# Should see order cycle selected in dropdown
|
||||
# (Should also render products)
|
||||
end
|
||||
|
||||
context "when no order cycles are available" do
|
||||
it "shows the last order cycle, if any"
|
||||
it "shows the next order cycle, if any"
|
||||
end
|
||||
|
||||
it "renders the order cycle selector when multiple order cycles are available"
|
||||
it "allows the user to select an order cycle"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user