bullet_train 1.12.0 → 1.12.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: bd6fdf70fe639d436c4c3a30bdb7334486a06fd164cc1143cfb7c61f594807a1
4
- data.tar.gz: 26bfbb1745af219cc5e1a88c63960091e988060b99e6d8c663849a182a2e2d75
3
+ metadata.gz: 359c742c2ad95d55fd469407fac668cbd94d6fd43643c0e1dedd705afaff1564
4
+ data.tar.gz: 504b342f64b691e89630dde9dd763bbcd9c23056c4fc6437532993e417f0716b
5
5
  SHA512:
6
- metadata.gz: 405d7b2680925803f52982019d1311f494b4bfb0d798b45898fc98afe6a2a0e2ce49e83af6ed2dc73fe6ba6f693a699a439e923d9ace5715e35fd68d3c4b2c59
7
- data.tar.gz: 1889ac585f748aaf37f4917750e5d4d26e8214a7aa164d8fe45354eab0f24d182ee3dc7bde4b2f45be3c3fe2b08a6d4788539b6bc95b5c14f66c969b79d55397
6
+ metadata.gz: 4099fd8c3c38bed877f1844127f998fc2b16d64beb9b4f3ff637f4706c18f8d0fdb74c5b1264c13a1e72b80d98cb0c71be799100f93a903480447562abbe2396
7
+ data.tar.gz: 0a74b016a9d0d7b027ce2c73cff11abfe6dc341d77854a50dbb127c086188187186c98ed23ed728d867d711c18339f0185c3699ec8dde5f09caa5435fda010a3
@@ -124,6 +124,10 @@ module Account::Invitations::ControllerBase
124
124
  raise "It looks like you've removed `permitted_fields` from your controller. This will break Super Scaffolding."
125
125
  end
126
126
 
127
+ def permitted_membership_fields
128
+ raise "It looks like you've removed `permitted_membership_fields` from your controller. This will break Super Scaffolding."
129
+ end
130
+
127
131
  def permitted_arrays
128
132
  raise "It looks like you've removed `permitted_arrays` from your controller. This will break Super Scaffolding."
129
133
  end
@@ -145,6 +149,7 @@ module Account::Invitations::ControllerBase
145
149
  # 🚅 super scaffolding will insert new fields above this line.
146
150
  # 🚅 super scaffolding will insert new arrays above this line.
147
151
  membership_attributes: [
152
+ *permitted_membership_fields,
148
153
  :user_first_name,
149
154
  :user_last_name,
150
155
  role_ids: []
@@ -33,6 +33,10 @@
33
33
  </div>
34
34
  <% end %>
35
35
  <% end %>
36
+
37
+ <% with_field_settings form: fields do %>
38
+ <%= render "account/memberships/fields", membership: fields.object, form: fields %>
39
+ <% end %>
36
40
  </div>
37
41
  <% end %>
38
42
  <% end %>
@@ -1,42 +1,44 @@
1
1
  <%= form_with(model: [:account, (@team unless membership.persisted?), membership], class: 'form', local: true) do |form| %>
2
2
  <%= render 'account/shared/forms/errors', form: form %>
3
3
 
4
- <% if membership.unclaimed? || membership.tombstone? %>
5
- <div class="grid grid-cols-1 gap-y gap-x sm:grid-cols-6">
6
- <div class="sm:col-span-3">
7
- <%= render 'shared/fields/text_field', form: form, method: :user_first_name %>
8
- </div>
9
4
 
10
- <div class="sm:col-span-3">
11
- <%= render 'shared/fields/text_field', form: form, method: :user_last_name %>
5
+ <% with_field_settings form: form do %>
6
+ <% if membership.unclaimed? || membership.tombstone? %>
7
+ <div class="grid grid-cols-1 gap-y gap-x sm:grid-cols-6">
8
+ <div class="sm:col-span-3">
9
+ <%= render 'shared/fields/text_field', form: form, method: :user_first_name %>
10
+ </div>
11
+
12
+ <div class="sm:col-span-3">
13
+ <%= render 'shared/fields/text_field', form: form, method: :user_last_name %>
14
+ </div>
12
15
  </div>
13
- </div>
14
- <% end %>
16
+ <% end %>
15
17
 
16
- <% if membership.tombstone? %>
17
- <% if cloudinary_enabled? %>
18
- <%= render 'shared/fields/cloudinary_image', form: form, method: :user_profile_photo_id %>
18
+ <% if membership.tombstone? %>
19
+ <% if cloudinary_enabled? %>
20
+ <%= render 'shared/fields/cloudinary_image', form: form, method: :user_profile_photo_id %>
21
+ <% end %>
19
22
  <% end %>
20
- <% end %>
21
23
 
22
- <%= hidden_field_tag 'membership[role_ids][]', nil %>
23
-
24
- <% Membership.assignable_roles.each do |role| %>
25
- <% if role.manageable_by?(current_membership.roles) %>
26
- <div class="flex items-top">
27
- <%= form.check_box :role_ids, {multiple: true, class: "h-4 w-4 text-primary-500 focus:ring-primary-500 border-slate-300 rounded mt-0.5"}, role.id, nil %>
28
- <label for="membership_role_ids_<%= role.id %>" class="ml-2 block select-none">
29
- <%= t('.grant_privileges_of', role_key: t(".fields.role_ids.options.#{role.key}.label")) %>
30
- <div class="mt-0.5 text-slate-400 font-light leading-normal">
31
- <%= t(".fields.role_ids.options.#{role.key}.description") %>
32
- </div>
33
- </label>
34
- </div>
24
+ <%= hidden_field_tag 'membership[role_ids][]', nil %>
25
+
26
+ <% Membership.assignable_roles.each do |role| %>
27
+ <% if role.manageable_by?(current_membership.roles) %>
28
+ <div class="flex items-top">
29
+ <%= form.check_box :role_ids, {multiple: true, class: "h-4 w-4 text-primary-500 focus:ring-primary-500 border-slate-300 rounded mt-0.5"}, role.id, nil %>
30
+ <label for="membership_role_ids_<%= role.id %>" class="ml-2 block select-none">
31
+ <%= t('.grant_privileges_of', role_key: t(".fields.role_ids.options.#{role.key}.label")) %>
32
+ <div class="mt-0.5 text-slate-400 font-light leading-normal">
33
+ <%= t(".fields.role_ids.options.#{role.key}.description") %>
34
+ </div>
35
+ </label>
36
+ </div>
37
+ <% end %>
35
38
  <% end %>
36
- <% end %>
37
39
 
38
- <%= render "account/memberships/fields", membership: membership, form: form %>
39
- <%# 🚅 super scaffolding will insert new fields above this line. %>
40
+ <%= render "account/memberships/fields", membership: membership, form: form %>
41
+ <% end %>
40
42
 
41
43
  <div class="buttons">
42
44
  <%= form.submit t('.buttons.update'), class: "button" %>
@@ -27,6 +27,7 @@
27
27
  <% end %>
28
28
  <% end %>
29
29
  <% end %>
30
+ <%= render "account/memberships/attributes", membership: @membership %>
30
31
  <% end %>
31
32
  <%# 🚅 super scaffolding will insert new fields above this line. %>
32
33
  <% end %>
@@ -32,7 +32,6 @@
32
32
  <% end %>
33
33
 
34
34
  <%= render "account/users/fields", user: user, form: form %>
35
- <%# 🚅 super scaffolding will insert new fields above this line. %>
36
35
  </div>
37
36
  <% end %>
38
37
 
@@ -147,6 +147,7 @@ Certain form field partials like `buttons` and `super_select` can also have thei
147
147
  | [`address_field`](/docs/field-partials/address-field.md) | `Address` | | | | Adds a block of address fields. On change, its country super-select auto-updates the state/province/region super-select and postal/zip code field label. |
148
148
  | `boolean` | `boolean` | | `assign_boolean` | | |
149
149
  | [`buttons`](/docs/field-partials/buttons.md) | `string` | Optionally | `assign_checkboxes` | | |
150
+ | `checkbox` | `boolean` | | `assign_boolean` | | |
150
151
  | `image` | `string` or `attachment`* | | | | |
151
152
  | `color_picker` | `string` | | | [pickr](https://simonwep.github.io/pickr/) | |
152
153
  | `date_and_time_field` | `datetime` | | | [Date Range Picker](https://www.daterangepicker.com) | |
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.12.0"
2
+ VERSION = "1.12.2"
3
3
  end
data/lib/bullet_train.rb CHANGED
@@ -73,7 +73,33 @@ def default_url_options_from_base_url
73
73
  end
74
74
 
75
75
  def heroku?
76
- ENV["HEROKU_APP_NAME"].present?
76
+ # This is a value we set in `app.json` so anyone using the "Deploy to Heroku" button
77
+ # should have it. This is kind of a brute force method that should be future-proofed
78
+ # against changes that Heroku might make to their runtime environment. We'll fallback
79
+ # to some additional checks if this isn't here, to maintain backwards compatibility
80
+ # for existing apps.
81
+ if ENV["BT_IS_IN_HEROKU"].present?
82
+ ENV["BT_IS_IN_HEROKU"] == "true"
83
+ else
84
+ # This requires the app to run `heroku labs:enable runtime-dyno-metadata` and then
85
+ # deploy at least once before the ENV var is set. Many existing BT apps have enabled
86
+ # this feature, and this used to be the only detection method that we had. We're
87
+ # keeping it for backwards compability reasons because it's probably more stable
88
+ # than the following fallbacks.
89
+ ENV["HEROKU_APP_NAME"].present? ||
90
+ # And finally we fallback to checking for some artifacts that Heroku happens to leave
91
+ # lying around. These may change in the future, so who knows how long they'll be good.
92
+ #
93
+ # If there's a `DYNO` ENV var, then we're probably on Heroku. Will they _always_ set
94
+ # this variable?
95
+ ENV["DYNO"].present? ||
96
+ # Finally we look for the the existence of the `/app/.heroku` directory.
97
+ # This should make detection work for apps that don't have any of the above ENV vars, for
98
+ # whatever reasons. But, in the future Heroku could decide to remove `/app/.heroku`
99
+ # which will break this fallback method and then we'll have to come up with something else.
100
+ # This is currently our last line of defense.
101
+ File.directory?("/app/.heroku")
102
+ end
77
103
  end
78
104
 
79
105
  def inbound_email_enabled?
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.12.0
4
+ version: 1.12.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: 2024-12-10 00:00:00.000000000 Z
11
+ date: 2024-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard