Grey out hubs that have no products available for distribution and are not in an order cycle

This commit is contained in:
Rohan Mitchell
2013-10-30 16:09:18 +11:00
parent fc8c82d5d2
commit 32889715f0
3 changed files with 32 additions and 8 deletions

View File

@@ -21,8 +21,12 @@
min-height: 200px;
}
a.inactive {
color: #6a6a6a;
}
.secondary {
color: #6A6A6A;
color: #6a6a6a;
}
.group-header {

View File

@@ -1,9 +1,11 @@
module TempLandingPageHelper
def temp_landing_page_distributor_link_class(distributor)
cart = current_order(true)
@active_distributors ||= Enterprise.active_distributors
klass = "shop-distributor"
klass += " empties-cart" unless cart.line_items.empty? || cart.distributor == distributor
klass += @active_distributors.include?(distributor) ? ' active' : ' inactive'
klass
end
end

View File

@@ -7,14 +7,18 @@ feature %q{
}, js: true do
include AuthenticationWorkflow
let(:d1) { create(:distributor_enterprise, name: 'Murandaka') }
let(:d2) { create(:distributor_enterprise, name: 'Ballantyne') }
let(:d3) { create(:distributor_enterprise, name: "O'Hea Street") }
let(:d4) { create(:distributor_enterprise, name: "PepperTree Place") }
let!(:eg1) { create(:enterprise_group, name: 'Group One',
on_front_page: true, enterprises: [d1, d2]) }
let!(:eg2) { create(:enterprise_group, name: 'Group Two',
on_front_page: true, enterprises: [d3, d4]) }
background do
d1 = create(:distributor_enterprise, name: 'Murandaka')
d2 = create(:distributor_enterprise, name: 'Ballantyne')
d3 = create(:distributor_enterprise, name: "O'Hea Street")
eg1 = create(:enterprise_group, name: 'Group One', on_front_page: true, enterprises: [d1, d2])
eg2 = create(:enterprise_group, name: 'Group Two', on_front_page: true, enterprises: [d3])
visit root_path
end
@@ -51,6 +55,20 @@ feature %q{
page.should have_content 'GROUP TWO'
page.should have_link "O'Hea Street"
page.should have_link "PepperTree Place"
end
it "should grey out hubs that have no products available for distribution and are not in an order cycle" do
create(:simple_order_cycle, distributors: [d1, d3])
create(:simple_product, distributors: [d1, d2])
visit root_path
page.should have_selector 'a.shop-distributor.active', text: 'Murandaka'
page.should have_selector 'a.shop-distributor.active', text: 'Ballantyne'
page.should have_selector 'a.shop-distributor.active', text: "O'Hea Street"
page.should have_selector 'a.shop-distributor.inactive', text: 'PepperTree Place'
end
it "should link to the hub page" do