Commit 4999bef
authored
Add allow empty option for @selectize/selectize (#2817)
This does several things in one go, because they can't be done
indepentantly:
1. Upgrades `@selectize/selectize` from v0.12 to v0.15,
2. Fixes #2545 (Selectize removes blank options from selects)
3. Closes #2790 (Add allow empty option)
Updating Selectize improved the visibility of empty options without
requiring custom CSS. However, due to compatibility issues between
Selectize, Rails, and Stimulus/Turbo, this ended up being a larger
change than expected.
Right after upgrading to @selectize/selectize, forms started hanging. To
address this, workaround is used. This issue is likely not limited to
Selectize.
It seems that every time we use a JS library, we’ll need to implement a
teardown() function to avoid similar problems. Switching from
disconnect() to teardown() also prevents a regression of #2811.
To prevent unintended removal when using `include_blank: false`, we also
introduce a workaround to prevent unintended deletions.
Finally, when updating a form with include_blank and navigating back via
Turbo, the placeholder would display only its first character. A full
page reload would render it correctly. To workaround this problem, we
use a placeholder of `---` instead of a meaningful string so that it
doesn't look wrong.
#2545
#2790
hotwired/stimulus#104 (comment)
#2811
selectize/selectize.js#1498
Updated selectize from 0.12 to @selectize/selectize 0.15
Used teardown instead of disconnect to address reinitialization issues
Refactor select for @selectize/selectize1 parent a517c32 commit 4999bef
File tree
17 files changed
+1679
-1449
lines changed- app
- assets
- builds/administrate
- javascripts/administrate
- controllers
- stylesheets/administrate
- views/fields
- belongs_to
- select
- lib/administrate/field
- spec
- administrate/views/fields/select
- lib/fields
17 files changed
+1679
-1449
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
9 | 19 | | |
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
7 | | - | |
| 12 | + | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
11 | 23 | | |
12 | 24 | | |
13 | 25 | | |
14 | | - | |
| 26 | + | |
15 | 27 | | |
16 | 28 | | |
17 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
0 commit comments