bullet_train-themes-light 1.5.1 → 1.5.2
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/app/views/showcase/previews/field_partials/_address_field.html.erb +22 -0
- data/app/views/showcase/previews/field_partials/_dependent_fields_frame.html.erb +45 -0
- data/app/views/showcase/previews/field_partials/attribute_partials/_about_attribute_partials.html.erb +15 -0
- data/app/views/showcase/previews/field_partials/attribute_partials/_address.html.erb +24 -0
- data/lib/bullet_train/themes/light/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89d8d353ebbebe4d434daa7ce82098c4719caf9cacece1f0a059b3cfb6ae3dc6
|
4
|
+
data.tar.gz: 6723e251304aee89039b63cdbf5d7a06bb3b6d56e59e02a8cef2369b267bb08b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1126a39d7d33624ff8a664389880f028b406bd92151647ae084a14358432513ccb2f73a6bd0f9e9d8767adf30cb8c76b530f3a5014c017bb19c3257bdddca47
|
7
|
+
data.tar.gz: '06670948f0906c2405f0b58893f3ef746d44f7d8e32e8056df27da69b4d14a12bf6247fc18b67af66dd633dee7e8ee349ff4717b2bbb3428d149a62f557f1d50'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% showcase.description do %>
|
2
|
+
When you're building forms, use Bullet Train's Field Partials for your form fields. They DRY-up all the presentation logic without needing a third-party dependency like Formtastic.
|
3
|
+
<br/>
|
4
|
+
<br/>
|
5
|
+
Read much more about them in the extensive <a href="https://bullettrain.co/docs/field-partials" target="_blank">developer documentation</a>.
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% form_with model: Scaffolding::CompletelyConcrete::TangibleThing.new, url: "#" do |form| %>
|
9
|
+
<%
|
10
|
+
form.object.address_value = Address.new
|
11
|
+
%>
|
12
|
+
|
13
|
+
<% showcase.sample "Basic" do %>
|
14
|
+
<%= render 'shared/fields/address_field', form: form, method: :address_value %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%# To display further options use `showcase.options.x` as options with a block will clear the old options. See `_options.html.erb` for an example. %>
|
19
|
+
<% showcase.options do |o| %>
|
20
|
+
<% o.required :form, "Reference to the form object", type: "ActionView::Helpers::FormBuilder" %>
|
21
|
+
<% o.required :method, "Attribute of the model" %>
|
22
|
+
<% end %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<% showcase.description do %>
|
2
|
+
Follows the <a href="/docs/field-partials/dynamic-forms-dependent-fields.md" target="_blank">Dependent Fields Pattern (See developer documentation)</a> to display form fields that depend on the value of another field.
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% form_with model: Scaffolding::CompletelyConcrete::TangibleThing.new, url: "#" do |form| %>
|
6
|
+
<%
|
7
|
+
form.object.boolean_button_value = false
|
8
|
+
%>
|
9
|
+
|
10
|
+
<% showcase.sample "Basic" do %>
|
11
|
+
<%# here we're wrapping the field to trap the `change` event %>
|
12
|
+
<%= tag.div data: {
|
13
|
+
'controller': "dependable",
|
14
|
+
'action': 'change->dependable#updateDependents',
|
15
|
+
'dependable-dependents-selector-value': "##{form.field_id(:button, :dependent_fields)}"
|
16
|
+
} do %>
|
17
|
+
<%= render "shared/fields/buttons",
|
18
|
+
form: form,
|
19
|
+
method: :boolean_button_value,
|
20
|
+
other_options: { label: "Should I present more fields?" } %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= render "shared/fields/dependent_fields_frame",
|
24
|
+
id: form.field_id(:button, :dependent_fields),
|
25
|
+
form: form,
|
26
|
+
dependable_fields: [:boolean_button_value] do %>
|
27
|
+
|
28
|
+
<div class="my-3">
|
29
|
+
<% if form.object.boolean_button_value %>
|
30
|
+
<strong>More fields would be shown here.</strong>
|
31
|
+
<% else %>
|
32
|
+
<em>No fields should be shown here.</em>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<% end %>
|
37
|
+
<% end %>
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
<%# To display further options use `showcase.options.x` as options with a block will clear the old options. See `_options.html.erb` for an example. %>
|
41
|
+
<% showcase.options do |o| %>
|
42
|
+
<% o.required :id, "id of the turbo_frame element" %>
|
43
|
+
<% o.required :form, "Reference to the form object", type: "ActionView::Helpers::FormBuilder" %>
|
44
|
+
<% o.required :dependable_fields, "Attributes of the model for the fields on whose values this frame depends", type: "Array" %>
|
45
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% showcase.description do %>
|
2
|
+
Attribute partials are used to display a single attribute of a model, within an `index` table colum or the resource's `show` screen.
|
3
|
+
|
4
|
+
Read more about them and about the form field partials in the extensive <a href="https://bullettrain.co/docs/field-partials" target="_blank">developer documentation</a>.
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<%= partial.body.optional.yield Scaffolding::CompletelyConcrete::TangibleThing.new %>
|
8
|
+
|
9
|
+
|
10
|
+
<%# To display further options use `showcase.options.x` as options with a block will clear the old options. See `_options.html.erb` for an example. %>
|
11
|
+
<% showcase.options do |o| %>
|
12
|
+
<% o.required :object, "Reference to the model object", type: "Object" %>
|
13
|
+
<% o.required :attribute, "Attribute of the model" %>
|
14
|
+
<%= partial.options.optional.yield o %>
|
15
|
+
<% end %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= render "showcase/previews/field_partials/attribute_partials/about_attribute_partials", showcase: showcase do |partial| %>
|
2
|
+
<% partial.body do |object| %>
|
3
|
+
<% object.address_value = Address.new(
|
4
|
+
country_id: 233,
|
5
|
+
address_one: "2800 East Observatory Road",
|
6
|
+
city: "Los Angeles",
|
7
|
+
region_id: 1416,
|
8
|
+
postal_code: "90027"
|
9
|
+
)
|
10
|
+
%>
|
11
|
+
|
12
|
+
<% showcase.sample "Multi-line" do %>
|
13
|
+
<%= render 'shared/attributes/address', object: object, attribute: :address_value %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<% showcase.sample "One-line" do %>
|
17
|
+
<%= render 'shared/attributes/address', object: object, attribute: :address_value, one_line: true %>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<% partial.options do |o| %>
|
22
|
+
<% o.optional :one_line, "Render into a single line", type: "Boolean" %>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-themes-light
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
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-
|
11
|
+
date: 2023-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|
@@ -133,11 +133,13 @@ files:
|
|
133
133
|
- app/javascript/application.light.js
|
134
134
|
- app/views/showcase/engine/_head.html.erb
|
135
135
|
- app/views/showcase/previews/field_partials/_about_field_partials.erb
|
136
|
+
- app/views/showcase/previews/field_partials/_address_field.html.erb
|
136
137
|
- app/views/showcase/previews/field_partials/_buttons.html.erb
|
137
138
|
- app/views/showcase/previews/field_partials/_cloudinary_image.html.erb
|
138
139
|
- app/views/showcase/previews/field_partials/_color_picker.html.erb
|
139
140
|
- app/views/showcase/previews/field_partials/_date_and_time_field.html.erb
|
140
141
|
- app/views/showcase/previews/field_partials/_date_field.html.erb
|
142
|
+
- app/views/showcase/previews/field_partials/_dependent_fields_frame.html.erb
|
141
143
|
- app/views/showcase/previews/field_partials/_email_field.html.erb
|
142
144
|
- app/views/showcase/previews/field_partials/_emoji_field.html.erb
|
143
145
|
- app/views/showcase/previews/field_partials/_file_field.html.erb
|
@@ -149,6 +151,8 @@ files:
|
|
149
151
|
- app/views/showcase/previews/field_partials/_text_area.html.erb
|
150
152
|
- app/views/showcase/previews/field_partials/_text_field.html.erb
|
151
153
|
- app/views/showcase/previews/field_partials/_trix_editor.html.erb
|
154
|
+
- app/views/showcase/previews/field_partials/attribute_partials/_about_attribute_partials.html.erb
|
155
|
+
- app/views/showcase/previews/field_partials/attribute_partials/_address.html.erb
|
152
156
|
- app/views/showcase/previews/partials/_alert.html.erb
|
153
157
|
- app/views/showcase/previews/partials/_box.html.erb
|
154
158
|
- app/views/showcase/previews/partials/_breadcrumb.html.erb
|