mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-05 02:41:33 +00:00
Create separate angular module
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
//= require ./orders/orders
|
||||
//= require ./order_cycles/order_cycles
|
||||
//= require ./payment_methods/payment_methods
|
||||
//= require ./product_import/product_import
|
||||
//= require ./products/products
|
||||
//= require ./resources/resources
|
||||
//= require ./shipping_methods/shipping_methods
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("ofn.admin").controller "DropdownPanelsCtrl", ($scope) ->
|
||||
angular.module("admin.productImport").controller "DropdownPanelsCtrl", ($scope) ->
|
||||
$scope.active = false
|
||||
|
||||
$scope.togglePanel = ->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("ofn.admin").controller "ImportFeedbackCtrl", ($scope) ->
|
||||
angular.module("admin.productImport").controller "ImportFeedbackCtrl", ($scope) ->
|
||||
|
||||
$scope.count = (items) ->
|
||||
total = 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("ofn.admin").controller "ImportFormCtrl", ($scope, $http, $filter, ProductImportService, $timeout) ->
|
||||
angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $http, $filter, ProductImportService, $timeout) ->
|
||||
|
||||
$scope.entries = {}
|
||||
$scope.update_counts = {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("ofn.admin").controller "ImportOptionsFormCtrl", ($scope, $rootScope, ProductImportService) ->
|
||||
angular.module("admin.productImport").controller "ImportOptionsFormCtrl", ($scope, $rootScope, ProductImportService) ->
|
||||
|
||||
$scope.initForm = () ->
|
||||
$scope.settings = {} if $scope.settings == undefined
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("ofn.admin").filter 'entriesFilterValid', ->
|
||||
angular.module("admin.productImport").filter 'entriesFilterValid', ->
|
||||
(entries, type) ->
|
||||
if type == 'all'
|
||||
return entries
|
||||
@@ -18,7 +18,7 @@ angular.module("ofn.admin").filter 'entriesFilterValid', ->
|
||||
|
||||
filtered
|
||||
|
||||
angular.module("ofn.admin").filter 'entriesFilterSupplier', ->
|
||||
angular.module("admin.productImport").filter 'entriesFilterSupplier', ->
|
||||
(entries, supplier) ->
|
||||
if supplier == 'all'
|
||||
return entries
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
angular.module("admin.productImport", ["ngResource"]).config ($httpProvider) ->
|
||||
$httpProvider.defaults.headers.common["X-CSRF-Token"] = $("meta[name=csrf-token]").attr("content")
|
||||
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("ofn.admin").factory "ProductImportService", ($rootScope) ->
|
||||
angular.module("admin.productImport").factory "ProductImportService", ($rootScope) ->
|
||||
new class ProductImportService
|
||||
suppliers: {}
|
||||
resetTotal: 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%div{ng: {app: 'ofn.admin'}}
|
||||
%div{ng: {app: 'admin.productImport'}}
|
||||
|
||||
%h5= t('admin.product_import.index.select_file')
|
||||
%br
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
= render partial: 'spree/admin/shared/product_sub_menu'
|
||||
|
||||
.import-wrapper{ng: {app: 'ofn.admin', controller: 'ImportFormCtrl', init: "supplier_product_counts = #{@importer.supplier_products.to_json}"}}
|
||||
.import-wrapper{ng: {app: 'admin.productImport', controller: 'ImportFormCtrl', init: "supplier_product_counts = #{@importer.supplier_products.to_json}"}}
|
||||
|
||||
- if @importer.item_count == 0 #and @importer.invalid_count
|
||||
%h5
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
%h5= t('admin.product_import.save.final_results')
|
||||
%br
|
||||
|
||||
%div.post-save-results{ng: {app: 'ofn.admin'}}
|
||||
%div.post-save-results{ng: {app: 'admin.productImport'}}
|
||||
|
||||
- if @importer.products_created_count > 0
|
||||
%p
|
||||
|
||||
Reference in New Issue
Block a user