diff --git a/app/assets/javascripts/admin/bulk_product_update.js.coffee b/app/assets/javascripts/admin/bulk_product_update.js.coffee index d3749c9f6c..9489411142 100644 --- a/app/assets/javascripts/admin/bulk_product_update.js.coffee +++ b/app/assets/javascripts/admin/bulk_product_update.js.coffee @@ -185,7 +185,6 @@ productsApp.controller "AdminBulkProductsCtrl", [ $scope.fetchProducts = -> # WARNING: returns a promise - #apply current filters $scope.loading = true queryString = $scope.currentFilters.reduce (qs,f) -> return qs + "q[#{f.property.db_column}_#{f.predicate.predicate}]=#{f.value};" diff --git a/app/views/spree/admin/products/bulk_edit.html.haml b/app/views/spree/admin/products/bulk_edit.html.haml index 8be3c35e29..3a946a8c46 100644 --- a/app/views/spree/admin/products/bulk_edit.html.haml +++ b/app/views/spree/admin/products/bulk_edit.html.haml @@ -45,7 +45,11 @@ %hr %div.loading{ 'ng-show' => 'loading' } %h4 Loading Products... - %div{ 'ng-hide' => 'loading' } + %div{ 'ng-show' => '!loading && products.length == 0' } + %h4{ :style => 'color:red;' } No matching products found. + %div{ 'ng-show' => 'products.length == 500' } + %h6 Search returned too many products to display (500+), please apply more search filters to reduce the number of matching products + %div{ 'ng-hide' => 'loading || products.length == 500 || products.length == 0' } %div.column_toggle %h5 Toggle Columns %input{ :type => 'button', :value => 'Toggle Columns', 'ofn-toggle-column-list' => true } diff --git a/spec/features/admin/bulk_product_update_spec.rb b/spec/features/admin/bulk_product_update_spec.rb index 8e2e3b6e96..17f4bfe53d 100644 --- a/spec/features/admin/bulk_product_update_spec.rb +++ b/spec/features/admin/bulk_product_update_spec.rb @@ -39,6 +39,20 @@ feature %q{ page.should have_field "product_name", with: p2.name, :visible => true end + it "displays a message when number of products is zero" do + visit '/admin/products/bulk_edit' + + page.should have_text "No matching products found." + end + + it "displays a message when number of products is too great" do + 501.times{ FactoryGirl.create(:simple_product) } + + visit '/admin/products/bulk_edit' + + page.should have_text "Search returned too many products to display (500+), please apply more search filters to reduce the number of matching products" + end + it "displays pagination information" do p1 = FactoryGirl.create(:product) p2 = FactoryGirl.create(:product) @@ -508,6 +522,7 @@ feature %q{ describe "using the page" do describe "using column display toggle" do it "shows a column display toggle button, which shows a list of columns when clicked" do + FactoryGirl.create(:simple_product) login_to_admin_section visit '/admin/products/bulk_edit'