mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Do not show any links to other steps when no distribution set
distribution means tuple: distributor + order cycle
This commit is contained in:
@@ -42,25 +42,26 @@
|
||||
%dd#date_complete
|
||||
= pretty_time(@order.completed_at)
|
||||
|
||||
%nav.menu
|
||||
%ul
|
||||
- customer_details_classes = "active" if current == "Customer Details"
|
||||
%li{ class: customer_details_classes }
|
||||
= link_to_with_icon 'icon-user', t(:customer_details), spree.admin_order_customer_url(@order)
|
||||
- if @order.distribution_set?
|
||||
%nav.menu
|
||||
%ul
|
||||
- customer_details_classes = "active" if current == "Customer Details"
|
||||
%li{ class: customer_details_classes }
|
||||
= link_to_with_icon 'icon-user', t(:customer_details), spree.admin_order_customer_url(@order)
|
||||
|
||||
- order_details_classes = "active" if current == "Order Details"
|
||||
%li{ class: order_details_classes }
|
||||
= link_to_with_icon 'icon-edit', t(:order_details), spree.edit_admin_order_url(@order)
|
||||
- order_details_classes = "active" if current == "Order Details"
|
||||
%li{ class: order_details_classes }
|
||||
= link_to_with_icon 'icon-edit', t(:order_details), spree.edit_admin_order_url(@order)
|
||||
|
||||
- payments_classes = "active" if current == "Payments"
|
||||
%li{ class: payments_classes }
|
||||
= link_to_with_icon 'icon-credit-card', t(:payments), spree.admin_order_payments_url(@order)
|
||||
- payments_classes = "active" if current == "Payments"
|
||||
%li{ class: payments_classes }
|
||||
= link_to_with_icon 'icon-credit-card', t(:payments), spree.admin_order_payments_url(@order)
|
||||
|
||||
- adjustments_classes = "active" if current == "Adjustments"
|
||||
%li{ class: adjustments_classes }
|
||||
= link_to_with_icon 'icon-cogs', t(:adjustments), spree.admin_order_adjustments_url(@order)
|
||||
- adjustments_classes = "active" if current == "Adjustments"
|
||||
%li{ class: adjustments_classes }
|
||||
= link_to_with_icon 'icon-cogs', t(:adjustments), spree.admin_order_adjustments_url(@order)
|
||||
|
||||
- if @order.completed?
|
||||
- authorizations_classes = "active" if current == "Return Authorizations"
|
||||
%li{ class: authorizations_classes }
|
||||
= link_to_with_icon 'icon-share-alt', t(:return_authorizations), spree.admin_order_return_authorizations_url(@order)
|
||||
- if @order.completed?
|
||||
- authorizations_classes = "active" if current == "Return Authorizations"
|
||||
%li{ class: authorizations_classes }
|
||||
= link_to_with_icon 'icon-share-alt', t(:return_authorizations), spree.admin_order_return_authorizations_url(@order)
|
||||
|
||||
@@ -109,6 +109,40 @@ describe '
|
||||
|
||||
expect(page).to have_content "Order cycle can't be blank"
|
||||
end
|
||||
|
||||
it "doesn't show links to other steps" do
|
||||
expect(page).not_to have_content "CUSTOMER DETAILS"
|
||||
expect(page).not_to have_content "ORDER DETAILS"
|
||||
expect(page).not_to have_content "PAYMENTS"
|
||||
expect(page).not_to have_content "ADJUSTMENTS"
|
||||
end
|
||||
end
|
||||
|
||||
context "when order has a distributor and order cycle" do
|
||||
before do
|
||||
order.distributor = distributor
|
||||
order.order_cycle = order_cycle
|
||||
order.save!
|
||||
login_as_admin
|
||||
visit spree.distribution_admin_order_path(order)
|
||||
end
|
||||
|
||||
it "can access the `/distribution` step" do
|
||||
expect(current_path).to eq spree.distribution_admin_order_path(order)
|
||||
expect(page).to have_content "DISTRIBUTION"
|
||||
end
|
||||
|
||||
it "shows the distributor and order cycle" do
|
||||
expect(page).to have_content distributor.name
|
||||
expect(page).to have_content order_cycle.name
|
||||
end
|
||||
|
||||
it "shows links to other steps" do
|
||||
expect(page).to have_content "CUSTOMER DETAILS"
|
||||
expect(page).to have_content "ORDER DETAILS"
|
||||
expect(page).to have_content "PAYMENTS"
|
||||
expect(page).to have_content "ADJUSTMENTS"
|
||||
end
|
||||
end
|
||||
|
||||
it "can add a product to an existing order" do
|
||||
|
||||
Reference in New Issue
Block a user