mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Add controls to alter the number of products displayed for BPE
This commit is contained in:
@@ -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)' }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user