mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
Fix supplier loader issue in enterprise controller
This commit is contained in:
@@ -93,4 +93,5 @@ angular.module("admin.enterprises")
|
||||
$scope.translation = (key) ->
|
||||
t('js.admin.enterprises.form.images.' + key)
|
||||
|
||||
RequestMonitor.load $scope.suppliers = Enterprises.index(action: "visible", ams_prefix: "basic", "q[is_primary_producer_eq]": "true")
|
||||
$scope.loadSuppliers = ->
|
||||
RequestMonitor.load $scope.suppliers = Enterprises.index(action: "visible", ams_prefix: "basic", "q[is_primary_producer_eq]": "true")
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
angular.module("admin.enterprises").directive "ofnProducerAutocomplete", (Enterprises, AutocompleteSelect2) ->
|
||||
scope: true
|
||||
link: (scope,element,attrs) ->
|
||||
scope.loadSuppliers() if !scope.suppliers
|
||||
multiple = scope.$eval attrs.multipleSelection
|
||||
placeholder = attrs.placeholder
|
||||
initialSelection = scope.$eval attrs.ngModel
|
||||
suppliers = scope.suppliers
|
||||
|
||||
setTimeout ->
|
||||
AutocompleteSelect2.autocomplete(
|
||||
multiple,
|
||||
placeholder,
|
||||
element,
|
||||
(-> Enterprises.findByID(initialSelection)),
|
||||
(-> Enterprises.findByIDs(initialSelection)),
|
||||
((term) -> Enterprises.findByTerm(suppliers, term))
|
||||
)
|
||||
scope.suppliers.$promise.then (data) ->
|
||||
AutocompleteSelect2.autocomplete(
|
||||
multiple,
|
||||
placeholder,
|
||||
element,
|
||||
(-> Enterprises.findByID(initialSelection)),
|
||||
(-> Enterprises.findByIDs(initialSelection)),
|
||||
((term) -> Enterprises.findByTerm(scope.suppliers, term))
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ input[type='button'], input[type='submit'] {
|
||||
color: #a1a1a1;
|
||||
}
|
||||
|
||||
.select2-search-choice {
|
||||
background-color: $disabled-background !important;
|
||||
&.select2-container-multi .select2-choices .select2-search-choice {
|
||||
background-color: $disabled-background;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user