Tidy up of new dashboard, add 'CREATE NEW' button at top right

This commit is contained in:
Rob H
2014-05-14 11:31:42 +10:00
parent c98d2e71d8
commit 31334be615
5 changed files with 124 additions and 36 deletions

View File

@@ -5,10 +5,8 @@ div.dashboard_item
text-align: center
div.header
border: solid
border-color: #5498da
border-width: 1px
border-radius: 6px 6px 0px 0px
border: 1px solid #5498da
position: relative
a.with-tip
@@ -29,7 +27,11 @@ div.dashboard_item
color: #DA7F52
h3
padding: 5px 5px 5px 3%
padding: 10px 5px 10px 3%
a
border-radius: 0px 4px 0px 0px
margin-left: 8px
.list
max-height: 250px
@@ -46,7 +48,7 @@ div.dashboard_item
padding: 10px 2px 10px 5%
.list-item
border: solid
border: solid #5498da
border-width: 0px 1px 0px 1px
span.alpha
font-weight: bold
@@ -107,11 +109,5 @@ div.dashboard_item
background-color: #DA5354
&:hover
background-color: #9fc820
&.top
border-radius: 6px 6px 0px 0px
&.bottom
border-radius: 0px 0px 6px 6px
&.top-right
border-radius: 0px 6px 0px 0px
&.top-left
border-radius: 6px 0px 0px 0px
border-radius: 0px 0px 6px 6px

View File

@@ -1,14 +1,18 @@
%div.dashboard_item.sixteen.columns.alpha
%div.dashboard_item.sixteen.columns.alpha#enterprises
%div.header.sixteen.columns.alpha{ :class => "#{@enterprises.count > 0 ? "" : "red"}"}
%h3.five.columns.alpha My Enterprises
%a.with-tip{ title: "Enterprises are Producers and/or Hubs and are the basic unit of organisation within the Open Food Network." } What's this?
%h3.thirteen.columns.alpha My Enterprises
- if @enterprises.any?
%a.three.columns.omega.icon-plus.button.blue{ href: "#{main_app.new_admin_enterprise_path}" }
CREATE NEW
- else
%a.with-tip{ title: "Enterprises are Producers and/or Hubs and are the basic unit of organisation within the Open Food Network." } What's this?
- if @enterprises.empty?
%div.sixteen.columns.alpha.list-item.red
%span.text.fifteen.columns.alpha You have no enterprises.
%span.text.fifteen.columns.alpha You don't have any enterprises yet.
%span.one.columns.omega
%span.icon-remove-sign
%a.sixteen.columns.alpha.button.bottom.red{ href: "#{main_app.new_admin_enterprise_path}" }
CREATE NEW ENTERPRISE
CREATE A NEW ENTERPRISE
%span.icon-arrow-right
- else
%div.sixteen.columns.alpha.list-title
@@ -22,20 +26,27 @@
%span.five.columns.alpha
= enterprise.name
%span.symbol.three.columns.centered
- if enterprise.payment_methods.count < 1 && enterprise.is_distributor
%span.icon-remove-sign.with-tip{ title: "This enterprise has no payment methods" }
- payment_method_count = enterprise.payment_methods.count
- if payment_method_count < 1 && enterprise.is_distributor
%span.icon-remove-sign.with-tip{ title: "#{enterprise.name} has no Payment Methods" }
- elsif enterprise.is_primary_producer
%span.icon-ok-sign.with-tip{ title: "Producers (like #{enterprise.name}) do not require Payment Methods." }
- else
%span.icon-ok-sign
%span.icon-ok-sign.with-tip{ title: "#{payment_method_count} Payment Method#{payment_method_count > 1 ? "s" : ""}" }
%span.symbol.three.columns.centered
- if enterprise.shipping_methods.count < 1 && enterprise.is_distributor
%span.icon-remove-sign.with-tip{ title: "This enterprise has no shipping methods" }
- else
%span.icon-ok-sign
- shipping_method_count = enterprise.shipping_methods.count
- if shipping_method_count < 1 && enterprise.is_distributor
%span.icon-remove-sign.with-tip{ title: "#{enterprise.name} has no Shipping Methods" }
- elsif enterprise.is_primary_producer
%span.icon-ok-sign.with-tip{ title: "Producers (like #{enterprise.name}) do not require Shipping Methods." }
-else
%span.icon-ok-sign.with-tip{ title: "#{shipping_method_count} Shipping Method#{shipping_method_count > 1 ? "s" : ""}" }
%span.symbol.three.columns.centered
- if enterprise.enterprise_fees.count > 0
%span.icon-ok-sign
- fee_count = enterprise.enterprise_fees.count
- if fee_count > 0
%span.icon-ok-sign.with-tip{ title: "#{fee_count} Fee#{fee_count > 1 ? "s" : ""}" }
- else
%span.icon-warning-sign.with-tip{ title: "This enterprise has no enterprise fees" }
%span.icon-warning-sign.with-tip{ title: "#{enterprise.name} has no Enterprise Fees" }
%span.two.columns.omega.right
%span.icon-arrow-right
%a.sixteen.columns.alpha.button.bottom.blue{ href: "#{main_app.admin_enterprises_path}" }

View File

@@ -1,7 +1,11 @@
%div.dashboard_item.seven.columns.omega
%div.dashboard_item.seven.columns.omega#order_cycles
%div.header.seven.columns.alpha{ :class => "#{@order_cycle_count > 0 ? "" : "orange"}"}
%h3.five.columns.alpha Order Cycles
%a.with-tip{ title: "Order cycles determine when and where your products are available to customers." } What's this?
%h3.four.columns.alpha Order Cycles
- if @order_cycle_count > 0
%a.three.columns.omega.icon-plus.button.blue{ href: "#{main_app.new_admin_order_cycle_path}" }
CREATE NEW
- else
%a.with-tip{ title: "Order cycles determine when and where your products are available to customers." } What's this?
%div.seven.columns.alpha.list
- if @order_cycle_count > 0
%div.seven.columns.alpha.list-item

View File

@@ -1,10 +1,11 @@
%div.dashboard_item.seven.columns.alpha
%div.dashboard_item.seven.columns.alpha#products
%div.header.seven.columns.alpha{ :class => "#{@product_count > 0 ? "" : "red"}"}
%h3.four.columns.alpha Products
-# %a.three.columns.omega.button.top-right.blue{ href: "#{new_admin_product_path}" }
-# ADD NEW
-# %span.icon-plus
%a.with-tip{ title: "The products that you sell through the Open Food Network." } What's this?
- if @product_count > 0
%a.three.columns.omega.icon-plus.button.blue{ href: "#{new_admin_product_path}" }
CREATE NEW
- else
%a.with-tip{ title: "The products that you sell through the Open Food Network." } What's this?
%div.seven.columns.alpha.list
- if @product_count > 0
%div.seven.columns.alpha.list-item
@@ -17,7 +18,7 @@
%span.icon-arrow-right
- else
%div.seven.columns.alpha.list-item.red
%span.six.columns.alpha You don't have any products yet.
%span.six.columns.alpha You don't have any active products.
%span.one.column.omega
%span.icon-remove-sign
%a.seven.columns.alpha.button.bottom.red{ href: "#{new_admin_product_path}" }

View File

@@ -0,0 +1,76 @@
require 'spec_helper'
feature %q{
As a backend user
I want to be given information about the state of my enterprises, products and order cycles
} , js: true do
include AuthenticationWorkflow
include AuthorizationHelpers
include WebHelper
stub_authorization!
context "as an enterprise user" do
before :each do
@enterprise_user = create_enterprise_user
Spree::Admin::OverviewController.any_instance.stub(:spree_current_user).and_return @enterprise_user
quick_login_as @enterprise_user
end
context "with no enterprises" do
it "prompts the user to create a new enteprise" do
visit '/admin'
page.should have_selector ".dashboard_item#enterprises h3", text: "My Enterprises"
page.should have_selector ".dashboard_item#enterprises .list-item", text: "You don't have any enterprises yet"
page.should have_selector ".dashboard_item#enterprises .button.bottom", text: "CREATE A NEW ENTERPRISE"
page.should_not have_selector ".dashboard_item#products"
page.should_not have_selector ".dashboard_item#order_cycles"
end
end
context "with an enterprise" do
let(:d1) { create(:distributor_enterprise) }
before :each do
@enterprise_user.enterprise_roles.build(enterprise: d1).save
end
it "displays information about the enterprise" do
visit '/admin'
page.should have_selector ".dashboard_item#enterprises h3", text: "My Enterprises"
page.should have_selector ".dashboard_item#products"
page.should have_selector ".dashboard_item#order_cycles"
page.should have_selector ".dashboard_item#enterprises .list-item", text: d1.name
page.should have_selector ".dashboard_item#enterprises .button.bottom", text: "MANAGE MY ENTERPRISES"
end
context "but no products or order cycles" do
it "prompts the user to create a new product and to manage order cycles" do
visit '/admin'
page.should have_selector ".dashboard_item#products h3", text: "Products"
page.should have_selector ".dashboard_item#products .list-item", text: "You don't have any active products."
page.should have_selector ".dashboard_item#products .button.bottom", text: "CREATE A NEW PRODUCT"
page.should have_selector ".dashboard_item#order_cycles h3", text: "Order Cycles"
page.should have_selector ".dashboard_item#order_cycles .list-item", text: "You don't have any active order cycles."
page.should have_selector ".dashboard_item#order_cycles .button.bottom", text: "MANAGE ORDER CYCLES"
end
end
context "and at least one product and active order cycle" do
let(:oc1) { create(:simple_order_cycle, distributors: [d1]) }
let(:p1) { create(:product, distributor: d1) }
it "displays information about products and order cycles" do
visit '/admin'
page.should have_selector ".dashboard_item#products h3", text: "Products"
page.should have_selector ".dashboard_item#products .list-item", text: "You don't have any active products."
page.should have_selector ".dashboard_item#products .button.bottom", text: "CREATE A NEW PRODUCT"
page.should have_selector ".dashboard_item#order_cycles h3", text: "Order Cycles"
page.should have_selector ".dashboard_item#order_cycles .list-item", text: "You don't have any active order cycles."
page.should have_selector ".dashboard_item#order_cycles .button.bottom", text: "MANAGE ORDER CYCLES"
end
end
end
end
end