administrate-field-belongs_to_search icon indicating copy to clipboard operation
administrate-field-belongs_to_search copied to clipboard

Javascript error: "SyntaxError: Unexpected token 'export'" and "TypeError: $element.selectize is not a function"

Open ErikDeBruijn opened this issue 3 years ago • 1 comments

I'm getting the following two errors in the JS console in Brave (Chromium based): image Note: I tried Firefox 96.0.1 (64-bit) as well, which resulted in the same exception on the console.

This is the line it highlights: image

I followed the Readme with SHA fc8eed4 and added the attribute to one dashboard. These are all my changes to my app:

diff --git a/StekkerWeb/Gemfile b/StekkerWeb/Gemfile
index c78f42f34..86f373ac5 100644
--- a/StekkerWeb/Gemfile
+++ b/StekkerWeb/Gemfile
@@ -6,6 +6,7 @@ ruby "3.0.2"
 gem "rails"

 gem "aasm"
+gem "administrate-field-belongs_to_search"
 gem "appsignal"
 gem "attr_encrypted", "~> 3.1.0"
diff --git a/StekkerWeb/Gemfile.lock b/StekkerWeb/Gemfile.lock
index c8c4a544e..cef95c67c 100644
--- a/StekkerWeb/Gemfile.lock
+++ b/StekkerWeb/Gemfile.lock
@@ -122,6 +122,11 @@ GEM
     administrate-field-active_storage (0.3.8)
       administrate (>= 0.2.2)
       rails (>= 6.0)
+    administrate-field-belongs_to_search (0.7.0)
+      administrate (>= 0.3, < 1.0)
+      jbuilder (~> 2)
+      rails (>= 4.2, < 7.0)
+      selectize-rails (~> 0.6)
     administrate-field-enum (0.0.9)
       administrate (~> 0.12)
@@ -673,6 +678,7 @@ DEPENDENCIES
   aasm
   administrate (= 0.16.0)
   administrate-field-active_storage
+  administrate-field-belongs_to_search
   administrate-field-enum
diff --git a/StekkerWeb/app/dashboards/charging_preference_dashboard.rb b/StekkerWeb/app/dashboards/charging_preference_dashboard.rb
index 163ddfc42..419abba3e 100644
--- a/StekkerWeb/app/dashboards/charging_preference_dashboard.rb
+++ b/StekkerWeb/app/dashboards/charging_preference_dashboard.rb
@@ -8,7 +8,7 @@ class ChargingPreferenceDashboard < Administrate::BaseDashboard
   # which determines how the attribute is displayed
   # on pages throughout the dashboard.
   ATTRIBUTE_TYPES = {
-    account: Field::BelongsTo,
+    account: Field::BelongsToSearch,

If you have any pointers or solution, that would be really helpful. Thanks!

ErikDeBruijn avatar Jan 18 '22 11:01 ErikDeBruijn

Any suggestions on how to provide a better bug submit are welcome, too...

ErikDeBruijn avatar Feb 07 '22 10:02 ErikDeBruijn