mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Offer nice select box for enterprise id
This commit is contained in:
@@ -10,6 +10,8 @@ module Admin
|
||||
@product_categories = Spree::Taxon.order('name ASC').pluck(:name).uniq
|
||||
@tax_categories = Spree::TaxCategory.order('name ASC').pluck(:name)
|
||||
@shipping_categories = Spree::ShippingCategory.order('name ASC').pluck(:name)
|
||||
@producers = OpenFoodNetwork::Permissions.new(spree_current_user).
|
||||
managed_product_enterprises.is_primary_producer.by_name.to_a
|
||||
end
|
||||
|
||||
def import
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
%h3 Import from DFC catalog
|
||||
%h3= t(".title")
|
||||
%br
|
||||
|
||||
= form_with url: main_app.admin_dfc_product_imports_path, method: :get do |form|
|
||||
= form.label :enterprise_id
|
||||
= form.text_field :enterprise_id
|
||||
= form.label :enterprise_id, t(".enterprise")
|
||||
%span.required *
|
||||
%br
|
||||
= form.label :catalog_url
|
||||
= form.text_field :catalog_url
|
||||
= form.select :enterprise_id, options_from_collection_for_select(@producers, :id, :name, @producers.first&.id), { "data-controller": "tom-select", class: "primary" }
|
||||
%br
|
||||
= form.submit "Import"
|
||||
%br
|
||||
= form.label :catalog_url, t(".catalog_url")
|
||||
%br
|
||||
= form.text_field :catalog_url, size: 60
|
||||
%br
|
||||
%br
|
||||
= form.submit t(".import")
|
||||
|
||||
@@ -929,6 +929,11 @@ en:
|
||||
product_categories: Product Categories
|
||||
tax_categories: Tax Categories
|
||||
shipping_categories: Shipping Categories
|
||||
dfc_import_form:
|
||||
title: "Import from DFC catalog"
|
||||
enterprise: "Enterprise"
|
||||
catalog_url: "DFC catalog URL"
|
||||
import: "Import"
|
||||
import:
|
||||
review: Review
|
||||
import: Import
|
||||
|
||||
@@ -7,7 +7,7 @@ describe "DFC Product Import" do
|
||||
include AuthorizationHelper
|
||||
|
||||
let(:user) { create(:oidc_user, owned_enterprises: [enterprise]) }
|
||||
let(:enterprise) { create(:enterprise) }
|
||||
let(:enterprise) { create(:supplier_enterprise) }
|
||||
let(:source_product) { create(:product, supplier: enterprise) }
|
||||
|
||||
before do
|
||||
@@ -20,7 +20,7 @@ describe "DFC Product Import" do
|
||||
it "imports from given catalog" do
|
||||
visit admin_product_import_path
|
||||
|
||||
fill_in "enterprise_id", with: enterprise.id
|
||||
select enterprise.name, from: "Enterprise"
|
||||
|
||||
# We are testing against our own catalog for now but we want to replace
|
||||
# this with the URL of another app when available.
|
||||
|
||||
Reference in New Issue
Block a user