diff --git a/app/views/spree/admin/products/bulk_index.html.haml b/app/views/spree/admin/products/bulk_index.html.haml index 6e04b42ca2..24cb2cac31 100644 --- a/app/views/spree/admin/products/bulk_index.html.haml +++ b/app/views/spree/admin/products/bulk_index.html.haml @@ -16,10 +16,13 @@ %thead %tr %th Name + %th Supplier %tbody{ 'ng-repeat' => 'product in products | filter:query' } %tr %td - %input.product_name{ 'ng-model' => "product.name", :name => 'product_name', :type => 'text' } + %input{ 'ng-model' => "product.name", :name => 'product_name', :type => 'text' } + %td + %select.select2{ :name => 'supplier_id', 'ng-model' => 'product.supplier_id', 'ng-options' => 's.id as s.name for s in suppliers' } %input{:type => 'button', :value => 'Update', 'ng-click' => 'prepareProductsForSubmit()'} %span{ id: "update-status-message", 'ng-style' => 'updateStatusMessage.style' } {{ updateStatusMessage.text }} \ No newline at end of file diff --git a/app/views/spree/admin/products/bulk_index.rep b/app/views/spree/admin/products/bulk_index.rep index 4a68e7f379..c639f70e93 100644 --- a/app/views/spree/admin/products/bulk_index.rep +++ b/app/views/spree/admin/products/bulk_index.rep @@ -1,4 +1,5 @@ r.list_of :products, @collection do r.element :id r.element :name + r.element :supplier_id end \ No newline at end of file diff --git a/spec/features/admin/bulk_product_update_spec.rb b/spec/features/admin/bulk_product_update_spec.rb index 8d747da100..92e2b5566d 100644 --- a/spec/features/admin/bulk_product_update_spec.rb +++ b/spec/features/admin/bulk_product_update_spec.rb @@ -17,13 +17,19 @@ feature %q{ end scenario "listing products" do + s1 = FactoryGirl.create(:supplier_enterprise) + s2 = FactoryGirl.create(:supplier_enterprise) + s3 = FactoryGirl.create(:supplier_enterprise) p = FactoryGirl.create(:product) + + p.supplier = s1; login_to_admin_section click_link 'Products' click_link 'Bulk Product Edit' page.should have_field "product_name", with: p.name + page.should have_select "supplier_id", with_options: [s1.name,s2.name,s3.name], selected: s1.name end scenario "create a new product" do @@ -53,20 +59,26 @@ feature %q{ scenario "updating a product" do - p = FactoryGirl.create(:product) s1 = FactoryGirl.create(:supplier_enterprise) s2 = FactoryGirl.create(:supplier_enterprise) + p = FactoryGirl.create(:product) p.supplier = s1 login_to_admin_section click_link 'Products' click_link 'Bulk Product Edit' + page.should have_field "product_name", with: p.name + page.should have_select "supplier_id", selected: s1.name + fill_in "product_name", with: "Big Bag Of Potatoes" + select(s2.name, :from => 'supplier_id') + click_button 'Update' page.find("span#update-status-message").should have_content "Update complete" click_link 'Bulk Product Edit' page.should have_field "product_name", with: "Big Bag Of Potatoes" + page.should have_select "supplier_id", selected: s2.name end end \ No newline at end of file