bullet_train 1.19.0 → 1.19.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f9f125206ee193a77eb9061af07ac76495ef5dd4bfc58aead9e3a50caf2a7c6
4
- data.tar.gz: d08447ca589c165727fa43a53e13d1ef9e2cc2b1a1518b613d5a04107f619d62
3
+ metadata.gz: 25357542c637b51836199e4c2c7eb1098da726f0bf6cfd941dfebb2464f1434c
4
+ data.tar.gz: d6ce5ec84eff8fd66df86be38647a821edcc7d37f70991ca013b387b97d38516
5
5
  SHA512:
6
- metadata.gz: f2155be565be0566b0b5919a59a65ff8db0be4516489be612eb3a002545ee8d09c2bf498f975978e8b737a8344f40a7e5f4d23153612631faea3ce4075785472
7
- data.tar.gz: 4ca2715224b6a31f5aac3b24bcbe966a166b0ad55c23f2e16bb79833e8661a922473f85a8541dfd6bf1afb1d988ec24b8340e233a15cde7f69e3fc0e73587d09
6
+ metadata.gz: 7ce4f17e7ec96fba77d8771a56174301e010e40f54b9ae8ac552b6415d1773fbfdad39d2848fd00c1037be4c0e4f40e4e6954af7c075d291ef633aeb0e3dba7f
7
+ data.tar.gz: 40a7147e189cb22ed5e3523eea6a669ea7339f3ab01dd3845c26e9434a9f1af0946a6d5547ef832aa8b285261433d5c085e0d99ecbb92cbc5004a5e085825f07
@@ -26,11 +26,16 @@ module Account::TeamsHelper
26
26
 
27
27
  def photo_for(object)
28
28
  background_color = Colorizer.colorize_similarly((object.name.to_s + object.created_at.to_s).to_s, 0.5, 0.6).delete("#")
29
+ avatar_name = if object.name.present?
30
+ "#{object.name.first}#{object.name.split.one? ? "" : object.name.split.first(2).last.first}"
31
+ else
32
+ "??"
33
+ end
29
34
  "https://ui-avatars.com/api/?" + {
30
35
  color: "ffffff",
31
36
  background: background_color,
32
37
  bold: true,
33
- name: "#{object.name.first}#{object.name.split.one? ? "" : object.name.split.first(2).last.first}",
38
+ name: avatar_name,
34
39
  size: 200,
35
40
  }.to_param
36
41
  end
@@ -1,4 +1,4 @@
1
- <%= form_with(model: [:account, (@team unless invitation.persisted?), invitation], class: 'form', local: true) do |form| %>
1
+ <%= form_with(model: [:account, (@team unless invitation.persisted?), invitation], class: 'form') do |form| %>
2
2
  <%= render "shared/limits/form", form: form, model: invitation.membership, cancel_path: @cancel_path || [:account, invitation] do %>
3
3
  <%= render 'account/shared/forms/errors', form: form %>
4
4
 
@@ -1,4 +1,4 @@
1
- <%= form_with(model: [:account, (@team unless membership.persisted?), membership], class: 'form', local: true) do |form| %>
1
+ <%= form_with(model: [:account, (@team unless membership.persisted?), membership], class: 'form') do |form| %>
2
2
  <%= render 'account/shared/forms/errors', form: form %>
3
3
 
4
4
 
@@ -4,7 +4,7 @@
4
4
  <% box.title @title %>
5
5
  <% box.body do %>
6
6
  <% within_fields_namespace(:self) do %>
7
- <%= form_with(model: @account_onboarding_invitation_list, class: 'form', local: true) do |f| %>
7
+ <%= form_with(model: @account_onboarding_invitation_list, class: 'form') do |f| %>
8
8
  <% f.object.errors.each do |error| %>
9
9
  <%= render 'account/shared/forms/errors', form: f, attributes: [error.attribute], resource: @account_onboarding_invitation_list %>
10
10
  <% end %>
@@ -1,4 +1,4 @@
1
- <%= form_with model: [:account, team], local: true, class: 'form' do |form| %>
1
+ <%= form_with model: [:account, team], class: 'form' do |form| %>
2
2
  <%= render 'account/shared/forms/errors', form: form %>
3
3
 
4
4
  <% with_field_settings form: form do %>
@@ -9,7 +9,7 @@ end
9
9
  <%= render 'account/shared/workflow/box' do |box| %>
10
10
  <% box.title @title %>
11
11
  <% box.body do %>
12
- <%= form_with model: @team, url: [:account, @team], local: true, class: 'form' do |form| %>
12
+ <%= form_with model: @team, url: [:account, @team], class: 'form' do |form| %>
13
13
  <%= render 'account/shared/notices' %>
14
14
  <%= render 'account/shared/forms/errors', form: form %>
15
15
 
data/docs/javascript.md CHANGED
@@ -4,6 +4,31 @@ Bullet Train leans into the use of [Stimulus](https://stimulus.hotwired.dev) for
4
4
  ## Writing Custom JavaScript
5
5
  The happy path for writing new custom JavaScript is to [write it as a Stimulus controller](https://stimulus.hotwired.dev/handbook/building-something-real) in `app/javascript/controllers` and invoke it by augmenting the HTML in your views. If you name the file `*_controller.js`, it will be automatically picked up and compiled as part of your application's JavaScript bundle. Be careful to [avoid adding scripts to the body of your pages (see below)](#avoid-scripts-in-the-body).
6
6
 
7
+ ## Overriding BulletTrain Stimulus Controllers
8
+
9
+ If you need to slightly tweak the behavior of the built-in Bullet Train Stimulus controllers you can do it easily.
10
+
11
+ Let's say you want to alter the SuperSelectController.
12
+
13
+ First create a file at: `app/javascript/controllers/fields/super_select_controller.js`
14
+
15
+ And then update that controller to first `import` the BT controller that you want to override,
16
+ and then `export` a class that `extends` the controller that you just imported.
17
+
18
+ For example, this will make it so that the BT Super Select controller will log a line to the console
19
+ every time that `connect` is called:
20
+
21
+ ```javascript
22
+ import { SuperSelectController } from '@bullet-train/fields'
23
+
24
+ export default class extends SuperSelectController {
25
+ connect() {
26
+ console.log('super_select_controller connected')
27
+ super.connect()
28
+ }
29
+ }
30
+ ```
31
+
7
32
  ## npm Packages
8
33
  npm packages are managed by [Yarn](https://yarnpkg.com) and any required importing can be done in `app/javascript/application.js`.
9
34
 
@@ -53,4 +78,4 @@ If you experience slow Turbo interactions, check for script tags in the body of
53
78
  <head>
54
79
  <script src="third-party-tracker.js" defer></script>
55
80
  </head>
56
- ```
81
+ ```
@@ -107,7 +107,7 @@ The first of these two forms is actually not shared between `new.html.erb` and `
107
107
  <% if @entry.entryable_type %>
108
108
  <%= render 'form', entry: @entry %>
109
109
  <% else %>
110
- <%= form_with model: @entry, url: [:new, :account, @team, :entry], method: :get, local: true, class: 'form' do |form| %>
110
+ <%= form_with model: @entry, url: [:new, :account, @team, :entry], method: :get, class: 'form' do |form| %>
111
111
  <%= render 'account/shared/forms/errors', form: form %>
112
112
  <% with_field_settings form: form do %>
113
113
  <%= render 'shared/fields/buttons', method: :entryable_type, html_options: {autofocus: true} %>
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.19.0"
2
+ VERSION = "1.19.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.0
4
+ version: 1.19.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-12 00:00:00.000000000 Z
10
+ date: 2025-03-25 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: standard