diff --git a/app/assets/javascripts/admin/bulk_product_update.js.coffee b/app/assets/javascripts/admin/bulk_product_update.js.coffee index 9c8119ec16..7fb34a8001 100644 --- a/app/assets/javascripts/admin/bulk_product_update.js.coffee +++ b/app/assets/javascripts/admin/bulk_product_update.js.coffee @@ -167,6 +167,7 @@ productsApp.controller "AdminBulkProductsCtrl", [ # Need to have suppliers before we get products so we can match suppliers to product.supplier dataFetcher("/api/products/managed?template=bulk_index;page=1;per_page=500").then (data) -> $scope.resetProducts data + $scope.loading = false else if authorise_api_reponse.hasOwnProperty("error") $scope.api_error_msg = authorise_api_reponse("error") else diff --git a/app/views/spree/admin/products/bulk_edit.html.haml b/app/views/spree/admin/products/bulk_edit.html.haml index 6e4d626e69..26f3162c5e 100644 --- a/app/views/spree/admin/products/bulk_edit.html.haml +++ b/app/views/spree/admin/products/bulk_edit.html.haml @@ -13,10 +13,12 @@ -%div{ 'ng-app' => 'bulk_product_update', 'ng-controller' => 'AdminBulkProductsCtrl', 'ng-init' => "initialise('#{@spree_api_key}');" } +%div{ 'ng-app' => 'bulk_product_update', 'ng-controller' => 'AdminBulkProductsCtrl', 'ng-init' => "initialise('#{@spree_api_key}');loading=true;" } %div{ 'ng-show' => '!spree_api_key_ok' } {{ api_error_msg }} - %div + %div.loading{ 'ng-show' => 'loading' } + %h2 Loading Products... + %div{ 'ng-hide' => 'loading' } %div.options Filter Results: %input.search{ 'ng-model' => 'query', :name => "quick_filter", :type => 'text', 'placeholder' => 'Search Value' } diff --git a/spec/features/admin/bulk_product_update_spec.rb b/spec/features/admin/bulk_product_update_spec.rb index 1b9413aea5..890de37968 100644 --- a/spec/features/admin/bulk_product_update_spec.rb +++ b/spec/features/admin/bulk_product_update_spec.rb @@ -21,14 +21,22 @@ feature %q{ login_to_admin_section end + it "displays a 'loading' splash for products" do + 101.times{ FactoryGirl.create(:product) } + + visit '/admin/products/bulk_edit' + + page.should have_selector "div.loading", :text => "Loading Products..." + end + it "displays a list of products" do p1 = FactoryGirl.create(:product) p2 = FactoryGirl.create(:product) visit '/admin/products/bulk_edit' - page.should have_field "product_name", with: p1.name - page.should have_field "product_name", with: p2.name + page.should have_field "product_name", with: p1.name, :visible => true + page.should have_field "product_name", with: p2.name, :visible => true end it "displays pagination information" do