remote_select 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/COPILOT_INSTRUCTIONS.md +10 -1
- data/app/javascript/remote_select.js +4 -1
- data/lib/remote_select/version.rb +1 -1
- data/lib/remote_select/view_helpers.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84f9fc3060e8325edfc34a2fb8e36f2803b6443445484b4c2e857df122f3af94
|
|
4
|
+
data.tar.gz: 3339eddc8e56eb12a6d83045a3a2265f0816eca4d20f80963b64fea9a61b2034
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad9030e0c36b6f2e3f30f0cb0b3f0e1ef65b140039f756f206fe0767ee4f702b573f14519e862380c3e58cceca0eb77eb7471729450e144f635535ed90172803
|
|
7
|
+
data.tar.gz: 70910706ca8bbb2a8d3a84c08d83e094c97d8e20a16b43916e1cfd90cd2c4c5a33391883cdc60f2c73de700c03d677eeccc60a58e6abf6aa72725018d6a5b40d
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.2.1] - 2026-05-30
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- `selected_value` is now written to the hidden input's `value` attribute so forms with a pre-selected value submit correctly without JS interaction.
|
|
9
|
+
- JS initialisation now explicitly sets `element.value` before calling `_updateTriggerDisplay()`, so the hidden field carries the correct value even when the widget renders before any user interaction.
|
|
10
|
+
|
|
5
11
|
## [0.2.0] - 2026-03-20
|
|
6
12
|
|
|
7
13
|
### Added
|
data/COPILOT_INSTRUCTIONS.md
CHANGED
|
@@ -138,7 +138,16 @@ Override CSS custom properties — no need to edit the stylesheet:
|
|
|
138
138
|
3. **Do NOT** forget the `text` key in JSON results — `name` won't work, must be `text`
|
|
139
139
|
4. **Do NOT** skip `selected_text` when setting `selected_value` — both are needed for preselection display
|
|
140
140
|
5. **Do NOT** add Stimulus controllers — the component auto-initializes on `DOMContentLoaded` and `turbo:load`
|
|
141
|
-
|
|
141
|
+
6. **Do NOT** manually `include RemoteSelect::ViewHelpers` in `ApplicationHelper` —
|
|
142
|
+
the constant is not yet defined at that load stage and you'll get a `NameError`.
|
|
143
|
+
The engine registers the helper automatically via `on_load(:action_view)`.
|
|
144
|
+
If for any reason that doesn't fire, add an initializer instead:
|
|
145
|
+
```ruby
|
|
146
|
+
# config/initializers/remote_select.rb
|
|
147
|
+
Rails.application.config.to_prepare do
|
|
148
|
+
ActionView::Base.include RemoteSelect::ViewHelpers
|
|
149
|
+
end
|
|
150
|
+
```
|
|
142
151
|
## JS API (for programmatic use)
|
|
143
152
|
|
|
144
153
|
```js
|
|
@@ -54,7 +54,10 @@ class RemoteSelect {
|
|
|
54
54
|
this._createUI();
|
|
55
55
|
this._setupEventListeners();
|
|
56
56
|
if (this.options.dependsOn) this._setupDependency();
|
|
57
|
-
if (this.selectedValue && this.selectedText)
|
|
57
|
+
if (this.selectedValue && this.selectedText) {
|
|
58
|
+
this.element.value = this.selectedValue;
|
|
59
|
+
this._updateTriggerDisplay();
|
|
60
|
+
}
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
_createUI() {
|
|
@@ -47,6 +47,7 @@ module RemoteSelect
|
|
|
47
47
|
html_options[:data] ||= {}
|
|
48
48
|
html_options[:data].merge!(data_attrs)
|
|
49
49
|
html_options[:class] = [html_options[:class], "remote-select-input"].compact.join(" ")
|
|
50
|
+
html_options[:value] ||= selected_value if selected_value.present?
|
|
50
51
|
|
|
51
52
|
form.hidden_field(attribute, html_options)
|
|
52
53
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: remote_select
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ghennadii Mir
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: railties
|