From 83e228dc6307377cf7341afd88cdcead527da81d Mon Sep 17 00:00:00 2001 From: Rob H Date: Sat, 22 Feb 2014 11:48:24 +1100 Subject: [PATCH] Display message when no matching orders found for BOM --- .../admin/orders/bulk_management.html.haml | 55 ++++++++++--------- .../admin/bulk_order_management_spec.rb | 5 ++ 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/app/views/spree/admin/orders/bulk_management.html.haml b/app/views/spree/admin/orders/bulk_management.html.haml index e5d2f4c926..b1ae78b36d 100644 --- a/app/views/spree/admin/orders/bulk_management.html.haml +++ b/app/views/spree/admin/orders/bulk_management.html.haml @@ -26,29 +26,34 @@ End Date %br %input{ :class => "four columns alpha", :type => "text", :id => 'end_date_filter', 'ng-model' => 'endDate', 'datetimepicker' => "endDate" } + .spacer{ :class => "seven columns alpha" } +   %hr{ :class => "sixteen columns alpha", :style => "margin-bottom: 15px" } - %table.index#listing_orders.bulk - %thead - %tr - %th.id ID - %th.email Email - %th.date Order Date - %th.producer Producer - %th.variant Product (Unit): Var - %th.quantity Quantity - %th.max Max - %th.actions - Ask?  - %input{ :type => 'checkbox', 'ng-model' => "confirmDelete" } - %tr.line_item{ 'ng-repeat' => 'line_item in lineItems | selectFilter:supplierFilter:distributorFilter', 'ng-class-even' => "'even'", 'ng-class-odd' => "'odd'" } - %td.id {{ line_item.id }} - %td.email {{ line_item.order.email }} - %td.date {{ line_item.order.completed_at }} - %td.producer {{ line_item.supplier.name }} - %td.variant {{ line_item.variant_unit_text }} - %td.quantity - %input{ :type => 'number', :name => 'quantity', 'ng-model' => "line_item.quantity", 'ofn-line-item-upd-attr' => "quantity" } - %td.max {{ line_item.max }} - %td.actions - %a{ 'ng-click' => "deleteLineItem(line_item)", :class => "delete-line-item icon-trash no-text" } - %input{ :type => "button", 'value' => 'Update', 'ng-click' => 'pendingChanges.submitAll()' } \ No newline at end of file + %div{ :class => "sixteen columns alpha", 'ng-show' => 'lineItems.length == 0'} + %h4{ :style => 'color:red;' } No matching orders found. + %div{ 'ng-hide' => 'lineItems.length == 0' } + %table.index#listing_orders.bulk + %thead + %tr + %th.id ID + %th.email Email + %th.date Order Date + %th.producer Producer + %th.variant Product (Unit): Var + %th.quantity Quantity + %th.max Max + %th.actions + Ask?  + %input{ :type => 'checkbox', 'ng-model' => "confirmDelete" } + %tr.line_item{ 'ng-repeat' => 'line_item in lineItems | selectFilter:supplierFilter:distributorFilter', 'ng-class-even' => "'even'", 'ng-class-odd' => "'odd'" } + %td.id {{ line_item.id }} + %td.email {{ line_item.order.email }} + %td.date {{ line_item.order.completed_at }} + %td.producer {{ line_item.supplier.name }} + %td.variant {{ line_item.variant_unit_text }} + %td.quantity + %input{ :type => 'number', :name => 'quantity', 'ng-model' => "line_item.quantity", 'ofn-line-item-upd-attr' => "quantity" } + %td.max {{ line_item.max }} + %td.actions + %a{ 'ng-click' => "deleteLineItem(line_item)", :class => "delete-line-item icon-trash no-text" } + %input{ :type => "button", 'value' => 'Update', 'ng-click' => 'pendingChanges.submitAll()' } \ No newline at end of file diff --git a/spec/features/admin/bulk_order_management_spec.rb b/spec/features/admin/bulk_order_management_spec.rb index fbfd8f9283..92a8320b98 100644 --- a/spec/features/admin/bulk_order_management_spec.rb +++ b/spec/features/admin/bulk_order_management_spec.rb @@ -29,6 +29,11 @@ feature %q{ page.should have_selector "h1.page-title", text: "Bulk Order Management" end + it "displays a message when number of products is zero" do + visit '/admin/orders/bulk_management' + page.should have_text "No matching orders found." + end + context "displaying the list of line items " do let!(:o1) { FactoryGirl.create(:order, state: 'complete', completed_at: Time.now ) } let!(:o2) { FactoryGirl.create(:order, state: 'complete', completed_at: Time.now ) }