Add messages to BPE interface for cases when 0 or > 500 products are found

This commit is contained in:
Rob H
2014-01-05 19:17:50 +08:00
parent 2e56d7a551
commit 49b9b8f635
3 changed files with 20 additions and 2 deletions

View File

@@ -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};"

View File

@@ -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 }

View File

@@ -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'