bullet_train 1.6.37 → 1.7.0

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: c92b0540ab3f8b4d802153c04206d3c336576736a7b0ee0ad8389a56e846f7ba
4
- data.tar.gz: 0c7efe34eb03bfc7444289c19ee91e9c4bf58ce8edc055fcbed9fc9c6a6bb281
3
+ metadata.gz: 14aab23772dad18189bc7ab18b5783c1a60e3de377241afded6bf91227096e22
4
+ data.tar.gz: 25dbcfe76b7f90ff2faaa31012b1c7c0b928d52718c6df4d1e6259cf9a10afc4
5
5
  SHA512:
6
- metadata.gz: b1de6904f14df8d8b82fb0fbd35cdee546761dd883399558afebd192acf1e2321ad471b84768c4f9f983892de391589977fa1d6ed85c2ec5f6f272d34c06629c
7
- data.tar.gz: f41788425410870ece98bd34d0d1df829f2c979edd717696357209f1dcf4e2a7a4b1e3e923bd8a1667390f82f1cfcede5e34ff89ae51f9892bd91842656924b2
6
+ metadata.gz: 014e04acc10bb9189420961de989644cd63918a09cc05f4937bad6f6b5a51691b86fd1e67770a603f26f58602d7776754eb7e74743e67ecdf519dbfc243a2d31
7
+ data.tar.gz: 05e6237879b28eca4dd01c3d1269b073d2cee3ed7204cf296950b815186d8a0248342936b10d3376167b4ff87d9d75862eaff5ea98c84319045cf1ba5a4ec0e7
@@ -31,7 +31,7 @@ module Account::Users::ControllerBase
31
31
  # TODO: We're keeping this method for backward compatibility in case someone in a downstream app
32
32
  # might be using it. At some point in the future (unclear exactly when) we should remove it.
33
33
  def updating_password?
34
- ActiveSupport::Deprecation.warn(
34
+ ActiveSupport::Deprecation.new.warn(
35
35
  "#updating_password? is deprecated. " \
36
36
  "Use #updating_password_or_email? instead."
37
37
  )
@@ -81,7 +81,7 @@ module Account::UsersHelper
81
81
  end
82
82
 
83
83
  if cloudinary_enabled?
84
- resource.send("#{photo_method}_id".to_sym)
84
+ resource.send(:"#{photo_method}_id")
85
85
  elsif resource.send(photo_method).attached?
86
86
  url_for(resource.send(photo_method))
87
87
  end
@@ -52,7 +52,7 @@ module Records::Base
52
52
  # identify them.
53
53
  def label_string
54
54
  if (label_attribute = self.class.label_attribute)
55
- send("#{label_attribute}_was")
55
+ send(:"#{label_attribute}_was")
56
56
  else
57
57
  self.class.name.underscore.split("/").last.titleize
58
58
  end
@@ -38,7 +38,7 @@ You can allow multiple buttons to be selected using the `multiple` option, like
38
38
 
39
39
  ```erb
40
40
  <%= render 'shared/fields/buttons', form: form, method: :category_ids,
41
- options: Category.all.map { |category| [category.id, category.label_string] }, multiple: true %>
41
+ options: Category.all.map { |category| [category.id, category.label_string] }, options: {multiple: true} %>
42
42
  ```
43
43
 
44
44
  ## Dynamically Updating Form Fields
@@ -48,4 +48,4 @@ If you'd like to:
48
48
  * modify other fields based on the value of your `buttons` field, or
49
49
  * modify your `buttons` field based on the value of other fields
50
50
 
51
- See [Dynamic Forms and Dependent Fields](/docs/field-partials/dynamic-forms-dependent-fields.md).
51
+ See [Dynamic Forms and Dependent Fields](/docs/field-partials/dynamic-forms-dependent-fields.md).
@@ -0,0 +1,54 @@
1
+ # Field Partial Options
2
+ Most field partials have a native Rails form helper working underneath. To see what options you can pass to a partial, check the API for the form helper you want to edit.
3
+
4
+ In addition, Bullet Train provides framework-specific options which you can pass as `other_options` to further customize your fields.
5
+
6
+ ## General `other_options` Types
7
+ Some partials have specific types of `other_options` available for only that partial. However, the following `other_options` are available for all field partials, and you can pass them to a field partial like this.
8
+
9
+ ```erb
10
+ <%= render 'shared/fields/text_field' method: :attribute_name, other_options: {help: "Custom help text"} %>
11
+ ```
12
+
13
+ | Key | Description |
14
+ |-----|-------------|
15
+ | `:help` | Pass a String to display help text |
16
+ | `:error` | Pass a String to write a custom error and outline the field in red |
17
+ | `:required` | Pass a Boolean to make this field required or not |
18
+ | `:label` | Pass a String to display a custom label |
19
+ | `:hide_label` | Pass a Boolean to hide the label |
20
+ | `:hide_custom_error` | Highlight the erroneous field in red, but hide the error message set in `:error` |
21
+ | `:icon` | Add a custom icon as an HTML class (i.e. - `ti ti-tablet`)|
22
+
23
+ ## `other_options` for Specific Field Partials
24
+ | Partial Name | Option | Description
25
+ |--------------|-------------------|-----------------|
26
+ | `password_field` | `:show_strength_indicator`* | Shows how strong the password is via a Stimulus controller with the colors red, yellow, and green. |
27
+ | `super_select` | Refer to the [super_select documentation](/docs/field-partials/super-select.md) | Super Select fields have different kinds of options which are covered in another page. |
28
+
29
+
30
+ *Currently, you must pass `:show_strength_indicator` to `options`, not `other_options`. This will change in a later version.
31
+
32
+ ## Field Partial Form Helpers
33
+
34
+ Most of the field partials have a native Rails form helper working underneath. Please use `bin/resolve` if you want to look at the source code for the partial (i.e. - `bin/resolve shared/fields/text_field`).
35
+
36
+ | Partial Name | Rails Form Helper |
37
+ |--------------|-------------------|
38
+ | `address_field` | [select](https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-select) |
39
+ | `boolean` | [radio_button](https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-radio_button) |
40
+ | `buttons` | [radio_button](https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-radio_button) ([check_box](https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-check_box) when `options[:multiple]` is `true`) |
41
+ | `image` | [file_field](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-file_field) when using ActiveStorage (No Rails form helper is called when using Cloudinary) |
42
+ | `color_picker` | [hidden_field](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-hidden_field) (Currently cannot edit this field) |
43
+ | `date_and_time_field` | [text_field](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-text_field) |
44
+ | `date_field` | [text_field](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-text_field) |
45
+ | `email_field` | [email_field](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-email_field) |
46
+ | `emoji_field` | [hidden_field](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-hidden_field) (Currently cannot edit this field) |
47
+ | `options` | [radio_button](https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-radio_button) ([check_box](https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-check_box) when `options[:multiple]` is `true`) |
48
+ | `password_field` | [password_field](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-password_field) |
49
+ | `phone_field` | [text_field](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-text_field) |
50
+ | `super_select` | [select](https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-select) |
51
+ | `text_area` | [text_area](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-text_area) |
52
+ | `text_field` | [text_field](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-text_field) |
53
+ | `number_field` | [number_field](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-number_field) |
54
+ | `trix_editor` | [rich_text_editor](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-rich_text_area) |
@@ -46,9 +46,21 @@ The 1:1 relationship between these field partials and their underlying Rails for
46
46
 
47
47
  Individual field partials might have additional options available based on the underlying Rails form field helper. Links to the documentation for individual form field partials are listed at the end of this page.
48
48
 
49
+ ## `options` vs. `html_options`
50
+
51
+ Most of the native form helpers use `options` to define html attributes like so:
52
+
53
+ ```ruby
54
+ def text_field(object, method, options = {})
55
+ ...
56
+ end
57
+ ```
58
+
59
+ However, the `super_select` partial uses `html_options` to define them. This is the same as the native Rails [select form helper](https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-select). Each field partial has its own set of arguments that can be passed to it depending on the underlying form helper, so please refer to the [field partial options](/docs/field-partials/options.md) documentation for more details.
60
+
49
61
  ## `options` vs. `other_options`
50
62
 
51
- Because Bullet Train field partials have more responsibilities than the underlying Rails form field helpers, there are also additional options for things like hiding labels, displaying specific error messages, etc. For these options, we pass them separately as `other_options`. This keeps them separate from the options in `options` that will be passed directly to the underlying Rails form field helper.
63
+ Because Bullet Train field partials have more responsibilities than the underlying Rails form field helpers, there are also additional options for things like hiding labels, displaying specific error messages, and more. For these options, we pass them separately as `other_options`. This keeps them separate from the options in `options` that will be passed directly to the underlying Rails form field helper.
52
64
 
53
65
  For example, to suppress a label on any field, we can use the `hide_label` option like so:
54
66
 
@@ -56,6 +68,8 @@ For example, to suppress a label on any field, we can use the `hide_label` optio
56
68
  <%= render 'shared/fields/text_field', form: form, method: :text_field_value, other_options: {hide_label: true} %>
57
69
  ```
58
70
 
71
+ Please refer to the [field partial options](/docs/field-partials/options.md) documentation for more details.
72
+
59
73
  ### Globally-Available `other_options` Options
60
74
 
61
75
  | Key | Value Type | Description |
@@ -264,6 +264,16 @@ In `package.json`, replace the `build` and `build:css` entries under `scripts` w
264
264
  "build:css": "bin/link; THEME=\"light\" tailwindcss --postcss --minify -c ./tailwind.config.js -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.tailwind.css",
265
265
  ```
266
266
 
267
+ ### Define `current_theme` helper
268
+
269
+ In your `app/helpers/application_helper.rb`, define:
270
+
271
+ ```
272
+ def current_theme
273
+ :light
274
+ end
275
+ ```
276
+
267
277
  ### Add `stylesheet_link_tag` to `<head>`
268
278
 
269
279
  Make sure you have the following three lines in your `<head>`, which should be defined in `app/views/layouts/application.html.erb`:
@@ -418,13 +428,11 @@ Add the following classes to your `html` tag for your layout:
418
428
 
419
429
  If you'd like to create your own theme but would still like to build on top of `:light`, you'll need to have both gems installed and you'll be able to switch the current theme this way.
420
430
 
421
- Define `current_theme` in `app/helpers/application_helper.rb`
431
+ Change the `current_theme` value in `app/helpers/application_helper.rb`
422
432
 
423
433
  ```
424
- module ApplicationHelper
425
- def current_theme
426
- :light
427
- end
434
+ def current_theme
435
+ :super_custom_theme
428
436
  end
429
437
  ```
430
438
 
@@ -94,6 +94,16 @@ Remove or comment out the following line from `esbuild.config.js`:
94
94
  "intl-tel-input-utils": path.join(process.cwd(), "app/javascript/intl-tel-input-utils.js"),
95
95
  ```
96
96
 
97
+ ### Define `current_theme` helper
98
+
99
+ In your `app/helpers/application_helper.rb`, define:
100
+
101
+ ```
102
+ def current_theme
103
+ :light
104
+ end
105
+ ```
106
+
97
107
  ### Add `stylesheet_link_tag` to `<head>`
98
108
 
99
109
  Make sure you have the following three lines in your `<head>`, which should be defined in `app/views/layouts/application.html.erb`:
@@ -231,13 +241,11 @@ Add the following classes to your `html` tag for your layout:
231
241
 
232
242
  If you'd like to create your own theme but would still like to build on top of `:light`, you'll need to have both gems installed and you'll be able to switch the current theme this way.
233
243
 
234
- Define `current_theme` in `app/helpers/application_helper.rb`
244
+ Change the `current_theme` value in `app/helpers/application_helper.rb`
235
245
 
236
246
  ```
237
- module ApplicationHelper
238
- def current_theme
239
- :light
240
- end
247
+ def current_theme
248
+ :super_custom_theme
241
249
  end
242
250
  ```
243
251
 
data/docs/upgrades.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div class="rounded-md border bg-amber-100 border-amber-200 py-4 px-5 mb-3 not-prose">
4
4
  <h3 class="text-sm text-amber-800 font-light mb-2">
5
- Note: These ugrade steps have recently changed.
5
+ Note: These upgrade steps have recently changed.
6
6
  </h3>
7
7
  <p class="text-sm text-amber-800 font-light mb-2">
8
8
  These instructions assume that you're doing a stepwise upgrade on an app that's already on version <code>1.4.0</code> or later.
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.6.37"
2
+ VERSION = "1.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.37
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 00:00:00.000000000 Z
11
+ date: 2024-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -730,6 +730,7 @@ files:
730
730
  - docs/field-partials/date-related-fields.md
731
731
  - docs/field-partials/dynamic-forms-dependent-fields.md
732
732
  - docs/field-partials/file-field.md
733
+ - docs/field-partials/options.md
733
734
  - docs/field-partials/super-select.md
734
735
  - docs/font-awesome-pro.md
735
736
  - docs/getting-started.md