bullet_train-themes-tailwind_css 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d257c560a57f176e3f30a071ed66cf5fb5e44a2f961158ce43515fe328a305ad
4
- data.tar.gz: 7cdeec0ccaa1839cfe10a4de5175e84e3d4c108d31f94e79c5a7b833ea9b0d0f
3
+ metadata.gz: b11ee7647eb9f26a7f54ef1b9a6765bcb0e4ff23d071feaefcb7e4417824521e
4
+ data.tar.gz: cfaf12c4739a14ef54be81c9ba995ef0b38d39ebe8f9460c76251469ac1e1e46
5
5
  SHA512:
6
- metadata.gz: 7894d62dafd806623064b58123807016a74fae35542b250a13e10ddb63bb2868bb7acaf97ad75306adfdc44ed390d105579b5b2b22ad556687b146e6e892ed67
7
- data.tar.gz: b9447de17ebd54bc2d03f9d059f203becfcd59b9866d2ec010a4437073f54778b1bf5687613c3c9b3e1adc57c8a49d94b50980dcea559ae7e1630b3477ed0259
6
+ metadata.gz: a60ce2e6ed4d2a786bc710c625da5d67d3678fc227f316b990a1228c78dcb29a350269ee08e14e575be29ccc34d0d3af00ad8e986ed305d049895d92eaa761ba
7
+ data.tar.gz: 4eea5e96d21f39046177ca6b1192d09a94e90255010d657423cf12b68146504c61d62027db94281672edadc43f7b193bf593fab65b83413e47ab74bd469ee4e0
@@ -4,15 +4,11 @@
4
4
  form ||= current_fields_form
5
5
  options ||= {}
6
6
  other_options ||= {}
7
- id_of_dependent_fields_frame = form.field_id(method, :dependent_fields)
8
7
  %>
9
8
 
10
9
  <%= form.fields_for(method) do |address_form| %>
11
10
  <% with_field_settings form: address_form do %>
12
11
 
13
- <% # For self-updating the fields in the turbo_frame further down %>
14
- <% accept_query_string_override_for(address_form, :country_id) %>
15
-
16
12
  <%= render 'shared/fields/super_select',
17
13
  method: :country_id,
18
14
  choices: populate_country_options,
@@ -23,7 +19,7 @@ id_of_dependent_fields_frame = form.field_id(method, :dependent_fields)
23
19
  data: {
24
20
  'controller': "dependable",
25
21
  'action': '$change->dependable#updateDependents',
26
- 'dependable-dependents-selector-value': "##{id_of_dependent_fields_frame}"
22
+ 'dependable-dependents-selector-value': "##{form.field_id(:country, :dependent_fields)}"
27
23
  }
28
24
  }
29
25
  %>
@@ -38,13 +34,11 @@ id_of_dependent_fields_frame = form.field_id(method, :dependent_fields)
38
34
  %>
39
35
  </div>
40
36
  <div class="sm:col-span-2">
41
- <%= turbo_frame_tag id_of_dependent_fields_frame,
42
- class: "block space-y-5",
43
- data: {
44
- 'controller': "refresh-fields",
45
- 'action': "dependable:updated->refresh-fields#updateFrameFromDependentField turbo:frame-render->refresh-fields#finishFrameUpdate",
46
- 'refresh-fields-loading-class': 'opacity-60'
47
- } do
37
+ <%= render "shared/fields/dependent_fields_frame",
38
+ id: form.field_id(:country, :dependent_fields),
39
+ form: address_form,
40
+ dependable_fields: [:country_id],
41
+ html_options: { class: "block space-y-5" } do |dependent_fields_controller_name|
48
42
  %>
49
43
 
50
44
  <div class="grid grid-cols-1 gap-y gap-x sm:grid-cols-2">
@@ -61,7 +55,7 @@ id_of_dependent_fields_frame = form.field_id(method, :dependent_fields)
61
55
  html_options: {
62
56
  disabled: address_form.object.country_id.nil?,
63
57
  data: {
64
- "refresh-fields-target": "field"
58
+ "#{dependent_fields_controller_name}-target": "field"
65
59
  }
66
60
  }
67
61
  %>
@@ -71,7 +65,7 @@ id_of_dependent_fields_frame = form.field_id(method, :dependent_fields)
71
65
  <%= render 'shared/fields/text_field', method: :postal_code,
72
66
  options: {
73
67
  data: {
74
- "refresh-fields-target": "field"
68
+ "#{dependent_fields_controller_name}-target": "field"
75
69
  }
76
70
  },
77
71
  other_options: {
@@ -0,0 +1,21 @@
1
+ <%
2
+ stimulus_controller = "dependent-fields-frame"
3
+ html_options ||= {}
4
+ html_options[:data] ||= {}
5
+ html_options[:data][:controller] ||= ""
6
+ html_options[:data][:controller] += " #{stimulus_controller}"
7
+ html_options[:data][:action] ||= ""
8
+ html_options[:data][:action] += " dependable:updated->#{stimulus_controller}#updateFrameFromDependableField turbo:frame-render->#{stimulus_controller}#finishFrameUpdate"
9
+ html_options[:data]["#{stimulus_controller}-loading-class"] ||= "opacity-60"
10
+
11
+ dependable_fields ||= []
12
+ %>
13
+ <%= turbo_frame_tag id, **html_options do %>
14
+ <%
15
+ dependable_fields.each do |method|
16
+ accept_query_string_override_for(form, method)
17
+ end
18
+ %>
19
+
20
+ <%= yield stimulus_controller %>
21
+ <% end %>
@@ -1,7 +1,7 @@
1
1
  module BulletTrain
2
2
  module Themes
3
3
  module TailwindCss
4
- VERSION = "1.5.1"
4
+ VERSION = "1.5.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-themes-tailwind_css
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-02 00:00:00.000000000 Z
11
+ date: 2023-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -89,6 +89,7 @@ files:
89
89
  - app/views/themes/tailwind_css/fields/_color_picker.html.erb
90
90
  - app/views/themes/tailwind_css/fields/_date_and_time_field.html.erb
91
91
  - app/views/themes/tailwind_css/fields/_date_field.html.erb
92
+ - app/views/themes/tailwind_css/fields/_dependent_fields_frame.html.erb
92
93
  - app/views/themes/tailwind_css/fields/_field.html.erb
93
94
  - app/views/themes/tailwind_css/fields/_file_field.html.erb
94
95
  - app/views/themes/tailwind_css/fields/_image.html.erb