mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-26 05:55:15 +00:00
Bulk product update rewrite: basic integration test passing
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
var productsApp = angular.module('bulk_product_update', [])
|
||||
|
||||
productsApp.config(["$httpProvider", function(provider) {
|
||||
provider.defaults.headers.common['X-CSRF-Token'] = $('meta[name=csrf-token]').attr('content');
|
||||
}]);
|
||||
|
||||
function AdminBulkProductsCtrl($scope, $timeout, $http) {
|
||||
$scope.refreshSuppliers = function(){
|
||||
$http.get('/enterprises/suppliers.json').success(function(data) {
|
||||
@@ -24,8 +30,7 @@ function AdminBulkProductsCtrl($scope, $timeout, $http) {
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: '/admin/products/bulk_update',
|
||||
data: productsToSubmit,
|
||||
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
|
||||
data: productsToSubmit
|
||||
})
|
||||
.success(function(data){
|
||||
if (angular.toJson($scope.products) == angular.toJson(data)){
|
||||
@@ -67,8 +72,6 @@ function AdminBulkProductsCtrl($scope, $timeout, $http) {
|
||||
}
|
||||
}
|
||||
|
||||
var productsApp = angular.module('bulk_product_update', [])
|
||||
|
||||
function sortByID(array){
|
||||
var sortedArray = [];
|
||||
for (var i in array){
|
||||
|
||||
Reference in New Issue
Block a user