tam_select 0.1.1 → 1.0.0
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/README.md +37 -3
- data/lib/tam_select/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e3f063f1d79268f900b10c4b86399cba1a34dac0154a90c4c12fd505771a1431
|
|
4
|
+
data.tar.gz: 0cf4fe7a1cf1d1dc479065318819db1ced4e71888e81e6c98a25fc6920841852
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ad40f38121d3e83e9260c825c8bbd7546c62d87073fef14ef63c70fd027a1a08bcbd18d51d60198d3a06410b2e3c3ffd325182f99b9b08c1af7b23e725a70c3
|
|
7
|
+
data.tar.gz: 55469f46c8348ed51dff78070efe3ddf8b95ce43cb2ae3d5b299382bf80437022fe1f91066e07c2b4d061abfba0c984d892d958616692a02415c062e4cb622db
|
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
# Tam Select
|
|
1
|
+
the # Tam Select
|
|
2
2
|
|
|
3
3
|
[](LICENSE)
|
|
4
|
+
[](https://github.com/tamiru/tam_select)
|
|
4
5
|
|
|
5
6
|
**Tam Select** is an accessible, searchable select component for Ruby on Rails, built for Simple Form, Stimulus, Turbo, and Tailwind CSS. It keeps the native `<select>` as the source of truth, so Rails form submission, validation, selected values, and browser autofill continue to work.
|
|
6
7
|
|
|
@@ -48,6 +49,23 @@ Add the generated JavaScript to Tailwind's source detection in `app/assets/tailw
|
|
|
48
49
|
@source "../../javascript/tam_select/**/*.js";
|
|
49
50
|
```
|
|
50
51
|
|
|
52
|
+
### Updating
|
|
53
|
+
|
|
54
|
+
The Rails integration files are copied into your application, so updating the gem does not update them automatically. Commit local customizations first, then run:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
bundle update tam_select
|
|
58
|
+
bin/rails generate tam_select:install
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Rails prompts before replacing changed files. To replace every generated file without prompting, use:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
bin/rails generate tam_select:install --force
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Review `git diff` afterward because `--force` overwrites application-specific customizations.
|
|
68
|
+
|
|
51
69
|
## Features
|
|
52
70
|
|
|
53
71
|
- Single and multiple selection
|
|
@@ -124,7 +142,7 @@ The install generator creates `app/inputs/tam_select_input.rb`. Use it like any
|
|
|
124
142
|
prompt: "Select region",
|
|
125
143
|
input_html: {
|
|
126
144
|
tam_options: {
|
|
127
|
-
remoteUrl:
|
|
145
|
+
remoteUrl: region_options_path(format: :json),
|
|
128
146
|
minQueryLength: 1
|
|
129
147
|
}
|
|
130
148
|
} %>
|
|
@@ -187,7 +205,7 @@ get "region_options", to: "region_options#index", defaults: { format: :json }
|
|
|
187
205
|
value_method: :id,
|
|
188
206
|
input_html: {
|
|
189
207
|
tam_options: {
|
|
190
|
-
remoteUrl: region_options_path,
|
|
208
|
+
remoteUrl: region_options_path(format: :json),
|
|
191
209
|
minQueryLength: 1
|
|
192
210
|
}
|
|
193
211
|
} %>
|
|
@@ -195,6 +213,22 @@ get "region_options", to: "region_options#index", defaults: { format: :json }
|
|
|
195
213
|
|
|
196
214
|
Do not accept a model name from request parameters. Declaring each source in a controller subclass prevents clients from querying arbitrary application models.
|
|
197
215
|
|
|
216
|
+
The browser sends requests such as:
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
GET /region_options.json?q=addis&page=1
|
|
220
|
+
Accept: application/json
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Test an endpoint independently with:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
curl -H "Accept: application/json" \
|
|
227
|
+
"http://localhost:3000/region_options.json?q=addis&page=1"
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
A `406 Not Acceptable` response means the route or controller rejected JSON. Keep `defaults: { format: :json }` on the route, use a `.json` URL, and ensure the controller does not restrict responses to HTML only.
|
|
231
|
+
|
|
198
232
|
## Core JavaScript
|
|
199
233
|
|
|
200
234
|
```js
|
data/lib/tam_select/version.rb
CHANGED