bullet_train-themes-light 1.6.38 → 1.7.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/app/helpers/{light_theme_helper.rb → theme_helper.rb} +1 -1
- data/app/views/showcase/previews/field_partials/_buttons.html.erb +1 -1
- data/app/views/showcase/previews/field_partials/_options.html.erb +1 -1
- data/app/views/themes/light/fields/_field.html.erb +30 -5
- data/lib/bullet_train/themes/light/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8cd8c8f227d8831226248a63618f7be2355217c9852e3ddf0f3df08fe24c97b
|
4
|
+
data.tar.gz: 927fcc1d0f8abbcc09eb45c88b6a81dd9e4a53f8ff34e631dce196d4da62ec38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd0f8c0b42a6a1012dcbff75b743033ad9fb4015f40d6d0d227c34b313790169a124d428ef2c5bfdf8bda000f460e7f56ca9b560bd97176da2fc3f73d8662ac1
|
7
|
+
data.tar.gz: d4ea72eb5d580348d2cd3dd7924fb3d1766c376e98b40aaaf3b5511993d2142acb914c685cb8823b1e82285e0522c5b72baa2aeec67848f1a5cac2a2982f0c69
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<% end %>
|
5
5
|
|
6
6
|
<% showcase.sample "Multiple Buttons" do %>
|
7
|
-
<%= render "shared/fields/buttons", form: form, method: :multiple_button_values, multiple: true %>
|
7
|
+
<%= render "shared/fields/buttons", form: form, method: :multiple_button_values, options: {multiple: true} %>
|
8
8
|
<% end %>
|
9
9
|
|
10
10
|
<% showcase.sample "Boolean Button" do %>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<% end %>
|
5
5
|
|
6
6
|
<% showcase.sample "Multiple Option" do %>
|
7
|
-
<%= render 'shared/fields/options', form: form, method: :multiple_option_values, multiple: true, show_select_all_top: true %>
|
7
|
+
<%= render 'shared/fields/options', form: form, method: :multiple_option_values, options: {multiple: true}, show_select_all_top: true %>
|
8
8
|
<% end %>
|
9
9
|
<% end %>
|
10
10
|
|
@@ -1,3 +1,17 @@
|
|
1
|
+
<%
|
2
|
+
# This is the main partial which all of our other field partials
|
3
|
+
# invoke in `bullet_train-themes/app/views/base/fields/`.
|
4
|
+
# `options`, `html_options` and `other_options`
|
5
|
+
# each serve their own specific purpose, so please read the
|
6
|
+
# Field Partial documentation to get more familiar with how these work.
|
7
|
+
# https://bullettrain.co/docs/field-partials
|
8
|
+
#
|
9
|
+
# Even though not all form helpers are invoked in this partial,
|
10
|
+
# all instances of `options` must be passed here because
|
11
|
+
# We add the `for` attribute for labels with `options[:id]`,
|
12
|
+
# and this isn't always as simple as `form.field_id(method)`.
|
13
|
+
%>
|
14
|
+
|
1
15
|
<%
|
2
16
|
%i[label field error help after_help].each do |key|
|
3
17
|
if (content = content_for(key).presence)
|
@@ -11,12 +25,18 @@ end
|
|
11
25
|
form ||= current_fields_form
|
12
26
|
# returns a struct with `label`, `placeholder`, and `help` methods.
|
13
27
|
labels = labels_for(form, method)
|
28
|
+
|
29
|
+
# Initialize options.
|
14
30
|
options ||= {}
|
31
|
+
other_options ||= {}
|
32
|
+
|
15
33
|
options[:id] ||= form.field_id(method)
|
16
|
-
# options[:disabled] ||= !field_editable?(form.object, method) if user_signed_in?
|
17
34
|
options[:placeholder] ||= labels.placeholder if labels.placeholder
|
18
35
|
|
19
|
-
|
36
|
+
# TODO: Why is this commented out, and where is `field_editable?`?
|
37
|
+
# Delete this and finish https://github.com/bullet-train-co/bullet_train-core/pull/587.
|
38
|
+
# options[:disabled] ||= !field_editable?(form.object, method) if user_signed_in?
|
39
|
+
|
20
40
|
other_options[:help] = [other_options[:help], labels.help].compact.join(" ")
|
21
41
|
|
22
42
|
if !other_options.key?(:required)
|
@@ -30,6 +50,8 @@ end
|
|
30
50
|
errors = [method, method.to_s.delete_suffix("_id").to_sym].uniq.map { |attribute| form.object.errors.full_messages_for(attribute) }.flatten
|
31
51
|
has_errors = errors.any? || partial.error? || other_options[:error].present?
|
32
52
|
|
53
|
+
# TODO: Partials which invoke form helpers inline aren't using
|
54
|
+
# these classes, although we have the `has_errors` conditional with some style below.
|
33
55
|
options[:class] = "#{options[:class]} block w-full rounded-md shadow-sm font-light dark:bg-slate-800 dark:text-slate-300"
|
34
56
|
options[:class] += " text-base md:text-sm" # default to 16px on mobile to prevent zooming
|
35
57
|
|
@@ -38,7 +60,6 @@ options[:class] += if has_errors
|
|
38
60
|
else
|
39
61
|
" focus:ring-primary-500 focus:border-primary-500 border-slate-300 dark:border-slate-900"
|
40
62
|
end
|
41
|
-
|
42
63
|
%>
|
43
64
|
|
44
65
|
<div class="<%= 'required' if other_options[:required] %>">
|
@@ -54,8 +75,12 @@ end
|
|
54
75
|
<% end %>
|
55
76
|
<% end %>
|
56
77
|
|
78
|
+
<%# Here, we prioritize yielding the partial's field markup if it already exists. %>
|
79
|
+
<%# `form.send` below calls the original Rails Form helpers, such as %>
|
80
|
+
<%# `form.text_field(method, options)`. Refer to the form helpers for more details: %>
|
81
|
+
<%# https://github.com/rails/rails/blob/main/actionview/lib/action_view/helpers/form_helper.rb %>
|
57
82
|
<div class="mt-1.5">
|
58
|
-
<% #
|
83
|
+
<% # The actual field. %>
|
59
84
|
<% if partial.field? %>
|
60
85
|
<%= partial.field %>
|
61
86
|
<% else %>
|
@@ -85,7 +110,7 @@ end
|
|
85
110
|
<% end %>
|
86
111
|
|
87
112
|
<% if other_options[:icon] %>
|
88
|
-
|
113
|
+
<div class="pre-icon os-icon <%= other_options[:icon] %>"></div>
|
89
114
|
<% end %>
|
90
115
|
|
91
116
|
</div>
|
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.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|
@@ -146,7 +146,7 @@ files:
|
|
146
146
|
- app/assets/stylesheets/tailwindcss/base.css
|
147
147
|
- app/assets/stylesheets/tailwindcss/components.css
|
148
148
|
- app/assets/stylesheets/tailwindcss/utilities.css
|
149
|
-
- app/helpers/
|
149
|
+
- app/helpers/theme_helper.rb
|
150
150
|
- app/javascript/application.light.js
|
151
151
|
- app/views/showcase/engine/_head.html.erb
|
152
152
|
- app/views/showcase/previews/field_partials/_about_field_partials.erb
|