mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Adding some specs, next order cycle, better CSS
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
@import 'branding'
|
||||
@import "compass/css3/user-interface"
|
||||
|
||||
.active_table
|
||||
margin: 2em 0em
|
||||
@include user-select(none)
|
||||
.active_table_row
|
||||
padding: 0.8em 0.5em
|
||||
display: block
|
||||
|
||||
@@ -19,7 +19,7 @@ hub
|
||||
border: 1px solid $clr-strong
|
||||
.active_table_row:first-child
|
||||
border-bottom: 1px solid $clr-strong
|
||||
.active_table_row:last-child
|
||||
.active_table_row.link
|
||||
padding: 0
|
||||
background-color: $clr-strong
|
||||
&:hover
|
||||
|
||||
@@ -47,6 +47,7 @@ class Enterprise < ActiveRecord::Base
|
||||
scope :with_distributed_products_outer,
|
||||
joins('LEFT OUTER JOIN product_distributions ON product_distributions.distributor_id = enterprises.id').
|
||||
joins('LEFT OUTER JOIN spree_products ON spree_products.id = product_distributions.product_id')
|
||||
|
||||
scope :with_order_cycles_outer,
|
||||
joins("LEFT OUTER JOIN exchanges ON (exchanges.receiver_id = enterprises.id AND exchanges.incoming = 'f')").
|
||||
joins('LEFT OUTER JOIN order_cycles ON (order_cycles.id = exchanges.order_cycle_id)')
|
||||
|
||||
28
app/views/darkswarm/_fat.html.haml
Normal file
28
app/views/darkswarm/_fat.html.haml
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
.row.active_table_row{"ng-show" => "open()"}
|
||||
.columns.small-4
|
||||
%strong Shop for
|
||||
%p
|
||||
Organics, Test data, Food boxes, fruit,
|
||||
kittens, Meat & Fish, Drinks
|
||||
.columns.small-4
|
||||
%strong Delivery options
|
||||
%ol
|
||||
%li.pickup{"bo-if" => "hub.pickup"} Pickup
|
||||
%li.delivery{"bo-if" => "hub.delivery"} Delivery
|
||||
.columns.small-4
|
||||
%strong Our producers
|
||||
%ol
|
||||
%li Fake Name Forever
|
||||
%li The Constant Gardener
|
||||
%li Shiny Olives
|
||||
%li Love in the Time of Cholera
|
||||
|
||||
.row.active_table_row.link{"ng-show" => "open()", "ng-if" => "hub.active"}
|
||||
.columns.small-11
|
||||
%a{"bo-href" => "hub.path"}
|
||||
Shop at
|
||||
%strong {{ hub.name }}
|
||||
.columns.small-1.text-right
|
||||
%a{"bo-href" => "hub.path"}
|
||||
%i.fi-arrow-right
|
||||
13
app/views/darkswarm/_skinny.html.haml
Normal file
13
app/views/darkswarm/_skinny.html.haml
Normal file
@@ -0,0 +1,13 @@
|
||||
.row.active_table_row{"ng-click" => "toggle()", "ng-class" => "{'closed' : !open()}"}
|
||||
.columns.small-4
|
||||
%strong {{ hub.name }}
|
||||
.columns.small-3
|
||||
{{ hub.address.city }}
|
||||
.columns.small-1
|
||||
{{ hub.address.state | uppercase }}
|
||||
.columns.small-3{"bo-if" => "hub.active"}
|
||||
Orders closing when?
|
||||
.columns.small-3{"bo-if" => "!hub.active"}
|
||||
Orders closed
|
||||
.columns.small-1.text-right
|
||||
%i{"ng-class" => "{'fi-arrow-down' : !open(), 'fi-arrow-up' : open()}"}
|
||||
@@ -35,45 +35,8 @@
|
||||
"ng-controller" => "HubNodeCtrl",
|
||||
id: "{{hub.path}}"}
|
||||
.small-12.columns
|
||||
.row.active_table_row{"ng-click" => "toggle()", "ng-class" => "{'closed' : !open()}"}
|
||||
.columns.small-4
|
||||
%strong {{ hub.name }}
|
||||
.columns.small-3
|
||||
{{ hub.address.city }}
|
||||
.columns.small-1
|
||||
{{ hub.address.state | uppercase }}
|
||||
.columns.small-3
|
||||
Orders closing when?
|
||||
.columns.small-1.text-right
|
||||
%i{"ng-class" => "{'fi-arrow-down' : !open(), 'fi-arrow-up' : open()}"}
|
||||
|
||||
.row.active_table_row{"ng-show" => "open()"}
|
||||
.columns.small-4
|
||||
%strong Shop for
|
||||
%p
|
||||
Organics, Test data, Food boxes, fruit,
|
||||
kittens, Meat & Fish, Drinks
|
||||
.columns.small-4
|
||||
%strong Delivery options
|
||||
%ol
|
||||
%li.pickup{"bo-if" => "hub.pickup"} Pickup
|
||||
%li.delivery{"bo-if" => "hub.delivery"} Delivery
|
||||
.columns.small-4
|
||||
%strong Our producers
|
||||
%ol
|
||||
%li Fake Name Forever
|
||||
%li The Constant Gardener
|
||||
%li Shiny Olives
|
||||
%li Love in the Time of Cholera
|
||||
|
||||
.row.active_table_row{"ng-show" => "open()"}
|
||||
.columns.small-11
|
||||
%a{"bo-href" => "hub.path"}
|
||||
Shop at
|
||||
%strong {{ hub.name }}
|
||||
.columns.small-1.text-right
|
||||
%a{"bo-href" => "hub.path"}
|
||||
%i.fi-arrow-right
|
||||
= render partial: 'darkswarm/skinny'
|
||||
= render partial: 'darkswarm/fat'
|
||||
|
||||
.small-12.columns
|
||||
.row{"ng-show" => "filteredHubs.length == 0"}
|
||||
|
||||
@@ -24,7 +24,6 @@ node :active do |hub|
|
||||
@active_distributors.include?(hub)
|
||||
end
|
||||
|
||||
# ALL PRODUCERS
|
||||
#
|
||||
# Orders closing when?
|
||||
# Current order_cycle + closing when?
|
||||
node :orders_close_at do |hub|
|
||||
OrderCycle.with_distributor(hub).soonest_closing.first.andand.orders_close_at
|
||||
end
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe DarkswarmController do
|
||||
#let(:distributor) { create(:distributor_enterprise) }
|
||||
render_views
|
||||
let(:distributor) { create(:distributor_enterprise) }
|
||||
|
||||
before do
|
||||
controller.stub(:load_data_for_sidebar).and_return nil
|
||||
Enterprise.stub(:distributors_with_active_order_cycles).and_return [distributor]
|
||||
Enterprise.stub(:is_distributor).and_return [distributor]
|
||||
end
|
||||
it "sets active distributors" do
|
||||
get :index
|
||||
assigns[:active_distributors].should == [distributor]
|
||||
end
|
||||
|
||||
# This is done inside RABL template
|
||||
it "gets the next order cycle for each hub" do
|
||||
OrderCycle.stub_chain(:with_distributor, :soonest_closing, :first)
|
||||
OrderCycle.should_receive(:with_distributor).with(distributor)
|
||||
get :index
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user