Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ErikDeBruijn opened this issue Jan 18, 2022 · 1 comment

Comments

@ErikDeBruijn
Copy link

ErikDeBruijn commented Jan 18, 2022

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant