mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
BOM: can update quantities of line_items
This commit is contained in:
@@ -64,11 +64,12 @@ orderManagementModule.factory "pendingChanges",[
|
||||
|
||||
|
||||
orderManagementModule.controller "AdminOrderMgmtCtrl", [
|
||||
"$scope", "$http", "dataFetcher", "blankEnterprise"
|
||||
($scope, $http, dataFetcher, blankEnterprise) ->
|
||||
"$scope", "$http", "dataFetcher", "blankEnterprise", "pendingChanges"
|
||||
($scope, $http, dataFetcher, blankEnterprise, pendingChanges) ->
|
||||
|
||||
$scope.lineItems = []
|
||||
$scope.confirmDelete = true
|
||||
$scope.pendingChanges = pendingChanges
|
||||
|
||||
$scope.initialise = (spree_api_key) ->
|
||||
authorise_api_reponse = ""
|
||||
|
||||
@@ -39,4 +39,5 @@
|
||||
%input{ :type => 'number', :name => 'quantity', 'ng-model' => "line_item.quantity", 'ofn-line-item-upd-attr' => "quantity" }
|
||||
%td.max {{ line_item.max }}
|
||||
%td.actions
|
||||
%a{ 'ng-click' => "deleteLineItem(line_item)", :class => "delete-line-item icon-trash no-text" }
|
||||
%a{ 'ng-click' => "deleteLineItem(line_item)", :class => "delete-line-item icon-trash no-text" }
|
||||
%input{ :type => "button", 'value' => 'Update', 'ng-click' => 'pendingChanges.submitAll()' }
|
||||
@@ -110,6 +110,25 @@ feature %q{
|
||||
page.should_not have_css "input[name='quantity'].update-pending"
|
||||
end
|
||||
end
|
||||
|
||||
context "submitting data to the server" do
|
||||
let!(:o1) { FactoryGirl.create(:order, state: 'complete', completed_at: Time.now ) }
|
||||
let!(:li1) { FactoryGirl.create(:line_item, order: o1, :quantity => 5 ) }
|
||||
|
||||
before :each do
|
||||
visit '/admin/orders/bulk_management'
|
||||
end
|
||||
|
||||
it "displays an update button which submits pending changes" do
|
||||
fill_in "quantity", :with => 2
|
||||
page.should have_selector "input[name='quantity'].update-pending"
|
||||
page.should_not have_selector "input[name='quantity'].update-success"
|
||||
page.should have_button "Update"
|
||||
click_button "Update"
|
||||
page.should_not have_selector "input[name='quantity'].update-pending"
|
||||
page.should have_selector "input[name='quantity'].update-success"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "using page page controls" do
|
||||
|
||||
Reference in New Issue
Block a user