diff --git a/app/views/spree/admin/products/bulk_edit.html.haml b/app/views/spree/admin/products/bulk_edit.html.haml index cfac83b1a9..65aaf6e620 100644 --- a/app/views/spree/admin/products/bulk_edit.html.haml +++ b/app/views/spree/admin/products/bulk_edit.html.haml @@ -28,6 +28,10 @@ %br.clear %br.clear %div{ :class => 'five columns' } + Show  + %select{ 'ng-model' => 'perPage', :name => 'perPage', 'ng-options' => 'pp for pp in [25,50,100,200]'} +  per page + %br %span Displaying {{firstVisibleProduct()}}-{{lastVisibleProduct()}} of {{totalCount()}} products %table.index#listing_products.bulk %colgroup @@ -50,7 +54,7 @@ %th{ 'ng-show' => 'columns.on_hand.visible' } On Hand %th{ 'ng-show' => 'columns.available_on.visible' } Av. On %th.actions - %tbody{ 'ng-repeat' => 'product in products | filter:query', 'ng-class-even' => "'even'", 'ng-class-odd' => "'odd'" } + %tbody{ 'ng-repeat' => 'product in products | filter:query', 'ng-class-even' => "'even'", 'ng-class-odd' => "'odd'", 'ng-show' => "$index >= perPage*(currentPage-1) && $index < perPage*currentPage" } %tr.product %td.left-actions %a{ 'ofn-toggle-variants' => 'true', :class => "view-variants icon-chevron-right", 'ng-show' => 'hasVariants(product)' } diff --git a/spec/features/admin/bulk_product_update_spec.rb b/spec/features/admin/bulk_product_update_spec.rb index f8ec324dda..4dbc029796 100644 --- a/spec/features/admin/bulk_product_update_spec.rb +++ b/spec/features/admin/bulk_product_update_spec.rb @@ -497,6 +497,28 @@ feature %q{ page.should have_selector "th", :text => "AV. ON" end end + + describe "using pagination controls" do + it "shows pagination controls" do + login_to_admin_section + + visit '/admin/products/bulk_edit' + + page.should have_select 'perPage', :selected => '25' + end + + it "allows the number of visible products to be altered" do + 27.times { FactoryGirl.create(:product) } + login_to_admin_section + + visit '/admin/products/bulk_edit' + + select '25', :from => 'perPage' + page.all("input[name='product_name']").select{|e| e.visible?}.length.should == 25 + select '50', :from => 'perPage' + page.all("input[name='product_name']").select{|e| e.visible?}.length.should == 27 + end + end end context "as an enterprise manager" do