bullet_train 1.7.13 → 1.7.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/javascript/controllers/bulk_action_form_controller.js +1 -1
- data/app/javascript/controllers/bulk_actions_controller.js +6 -6
- data/app/views/account/two_factors/create.js.erb +1 -1
- data/app/views/account/two_factors/destroy.js.erb +1 -1
- data/app/views/account/two_factors/verify.js.erb +1 -1
- data/app/views/devise/sessions/pre_otp.js.erb +6 -5
- data/docs/action-models.md +18 -6
- data/docs/authentication.md +42 -1
- data/lib/bullet_train/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af0fca71392fe7d398e8176b5234018b0aab24dfe7a73576922f1cf5b74f081d
|
4
|
+
data.tar.gz: 4de50fcafe861f2a149edd6d85cb3683317c5025d7953dad95de99dea1f96357
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9b2ae3b35bc83ab4eb173ee1e9531cddfc4c830c8f6f80b4731718739d7dc5e80acf93c548189b40197a5ebbb93d202d4e0afa4738049d9ff9a21985ae4c10b
|
7
|
+
data.tar.gz: 959e85a8d011dbe4104ffbdb0c051f8280f3fcae2e14f3e67adc530d218e1bcf1c18d66ce9d21e714ef80223783f7e879329c56234d640845bf2e6c441c0d8da
|
@@ -22,7 +22,7 @@ export default class extends Controller {
|
|
22
22
|
|
23
23
|
updateActions() {
|
24
24
|
this.actionTargets.forEach(actionTarget => {
|
25
|
-
actionTarget.dispatchEvent(new CustomEvent(
|
25
|
+
actionTarget.dispatchEvent(new CustomEvent(`${this.identifier}:update-ids`, { detail: {
|
26
26
|
ids: this.selectedIds,
|
27
27
|
all: this.allSelected
|
28
28
|
}}))
|
@@ -59,14 +59,14 @@ export default class extends Controller {
|
|
59
59
|
if (this.allSelected) {
|
60
60
|
checkbox.checked = true
|
61
61
|
checkbox.indeterminate = false
|
62
|
-
label.dispatchEvent(new CustomEvent(
|
62
|
+
label.dispatchEvent(new CustomEvent(`${this.identifier}:toggle-select-all-label`, { detail: { useAlternate: true }} ))
|
63
63
|
} else if (this.selectedIds.length > 0) {
|
64
64
|
checkbox.indeterminate = true
|
65
|
-
label.dispatchEvent(new CustomEvent(
|
65
|
+
label.dispatchEvent(new CustomEvent(`${this.identifier}:toggle-select-all-label`, { detail: { useAlternate: false }} ))
|
66
66
|
} else {
|
67
67
|
checkbox.checked = false
|
68
68
|
checkbox.indeterminate = false
|
69
|
-
label.dispatchEvent(new CustomEvent(
|
69
|
+
label.dispatchEvent(new CustomEvent(`${this.identifier}:toggle-select-all-label`, { detail: { useAlternate: false }} ))
|
70
70
|
}
|
71
71
|
}
|
72
72
|
|
@@ -77,7 +77,7 @@ export default class extends Controller {
|
|
77
77
|
|
78
78
|
updateToggleLabel() {
|
79
79
|
if (!this.hasSelectableToggleTarget) { return }
|
80
|
-
this.selectableToggleTarget.dispatchEvent(new CustomEvent(
|
80
|
+
this.selectableToggleTarget.dispatchEvent(new CustomEvent(`${this.identifier}:toggle-select-all-label`, { detail: { useAlternate: this.selectableValue }} ))
|
81
81
|
}
|
82
82
|
|
83
83
|
get selectedIds() {
|
@@ -93,4 +93,4 @@ export default class extends Controller {
|
|
93
93
|
get allSelected() {
|
94
94
|
return this.selectedIds.length === this.checkboxTargets.length
|
95
95
|
}
|
96
|
-
}
|
96
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
jQuery("#two-factor").html("<%= j render partial: "devise/registrations/two_factor"%>");
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
jQuery("#two-factor").html("<%= j render partial: "devise/registrations/two_factor"%>");
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
jQuery("#two-factor").html("<%= j render partial: "devise/registrations/two_factor", locals: {verified: @verified}%>");
|
@@ -1,11 +1,12 @@
|
|
1
1
|
<% if @email %>
|
2
|
-
|
3
|
-
|
2
|
+
document.querySelector("#step-1").classList.add("hidden");
|
3
|
+
document.querySelector("#step-2").classList.remove("hidden");
|
4
4
|
<% if @user&.otp_required_for_login %>
|
5
|
-
|
5
|
+
document.querySelector("#step-2-otp").classList.remove("hidden");
|
6
6
|
<% end %>
|
7
7
|
setTimeout(function() {
|
8
|
-
|
9
|
-
|
8
|
+
document.querySelector("#user_password").focus();
|
9
|
+
document.querySelector("#new_user").setAttribute('action', '/users/sign_in')
|
10
|
+
document.querySelector("#new_user").setAttribute('data-remote', 'false');
|
10
11
|
}, 1);
|
11
12
|
<% end %>
|
data/docs/action-models.md
CHANGED
@@ -66,6 +66,8 @@ You can get detailed information about using Super Scaffolding to generate diffe
|
|
66
66
|
rails generate super_scaffold:action_models:targets_many
|
67
67
|
rails generate super_scaffold:action_models:targets_one
|
68
68
|
rails generate super_scaffold:action_models:targets_one_parent
|
69
|
+
rails generate super_scaffold:action_models:performs_import
|
70
|
+
rails generate super_scaffold:action_models:performs_export
|
69
71
|
```
|
70
72
|
|
71
73
|
## Basic Example
|
@@ -104,7 +106,7 @@ For example:
|
|
104
106
|
|
105
107
|
```
|
106
108
|
# side quest: update the generated migration with `default: false` on the new boolean field.
|
107
|
-
|
109
|
+
rails g super_scaffold:crud_field Projects::ArchiveAction notify_users:boolean
|
108
110
|
```
|
109
111
|
|
110
112
|
Now users will be prompted with that option when they perform this action, and you can update your logic to take action based on it, or at least pass on the information to another method that takes action based on it:
|
@@ -117,11 +119,13 @@ end
|
|
117
119
|
|
118
120
|
## Action Types
|
119
121
|
|
120
|
-
Action Models can be generated in
|
122
|
+
Action Models can be generated in five flavors:
|
121
123
|
|
122
|
-
- `
|
123
|
-
- `
|
124
|
-
- `
|
124
|
+
- `rails g super_scaffold:action_models:targets_many`
|
125
|
+
- `rails g super_scaffold:action_models:targets_one`
|
126
|
+
- `rails g super_scaffold:action_models:targets_one_parent`
|
127
|
+
- `rails g super_scaffold:action_models:performs_import`
|
128
|
+
- `rails g super_scaffold:action_models:performs_export`
|
125
129
|
|
126
130
|
### Targets Many
|
127
131
|
|
@@ -137,7 +141,15 @@ When deciding between "targets many" and "targets one", our recommendation is th
|
|
137
141
|
|
138
142
|
### Targets One Parent
|
139
143
|
|
140
|
-
This
|
144
|
+
This type of action is available for things like custom/complex importers that don't necessarily target specific existing objects by ID, but instead create many new or affect many existing objects under a specific parent based on the configuration of the action (like an attached CSV file.) These objects don't "target many" per se, but they live at the same level (and belong to the same parent) as the models they end up creating or affecting.
|
145
|
+
|
146
|
+
### Performs Import
|
147
|
+
|
148
|
+
This action is useful for allowing users to upload a CSV representing a list of models that they'd like to have created in the system. It handles mapping columns in the CSV to attributes on the model you're creating.
|
149
|
+
|
150
|
+
### Performs Export
|
151
|
+
|
152
|
+
This action will allow users to export a CSV from a list of models in the application.
|
141
153
|
|
142
154
|
## Frequently Asked Questions
|
143
155
|
|
data/docs/authentication.md
CHANGED
@@ -24,8 +24,49 @@ If you want to disable new registrations completely, put an unguessable value in
|
|
24
24
|
Note that in both of these scenarios that existing users will still be able to invite new collaborators to their teams and those collaborators will have the option of creating a new account, but no users in the application will be allowed to create a new team without an invitation code and following the above URL.
|
25
25
|
|
26
26
|
## Enabling Two-Factor Authentication (2FA)
|
27
|
-
Two-factor authentication is enabled by default in Bullet Train, but you must have Rails built-in encrypted secrets and Active Record Encryption configured.
|
27
|
+
Two-factor authentication is enabled by default in Bullet Train, but you must have Rails built-in encrypted secrets and Active Record Encryption configured.
|
28
|
+
|
29
|
+
To do this, first run:
|
28
30
|
|
29
31
|
```
|
30
32
|
bin/secrets
|
31
33
|
```
|
34
|
+
|
35
|
+
That will generate some credentails files for you.
|
36
|
+
|
37
|
+
Then you'll need to set encryption keys, either in those newly generated credentials files, or you can do it via environment variables.
|
38
|
+
|
39
|
+
Generate some keys by running:
|
40
|
+
|
41
|
+
```
|
42
|
+
bin/rails db:encryption:init
|
43
|
+
```
|
44
|
+
|
45
|
+
That will output something like this:
|
46
|
+
|
47
|
+
```
|
48
|
+
active_record_encryption:
|
49
|
+
primary_key: NLngkt...
|
50
|
+
deterministic_key: edpu...
|
51
|
+
key_derivation_salt: Bfwy...
|
52
|
+
```
|
53
|
+
|
54
|
+
Then to add them to your `development` credentials file run:
|
55
|
+
|
56
|
+
```
|
57
|
+
bin/rails credentials:edit --environment development
|
58
|
+
```
|
59
|
+
|
60
|
+
That will decrypt `config/credentials/development.yml.enc` and open it in your editor. Paste in the block of keys you generated in the previous step, save, and close the file.
|
61
|
+
|
62
|
+
If you'd rather set them via environment variables you could add something like this to `config/application.rb`:
|
63
|
+
|
64
|
+
```
|
65
|
+
config.active_record.encryption.primary_key = ENV['ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY']
|
66
|
+
config.active_record.encryption.deterministic_key = ENV['ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY']
|
67
|
+
config.active_record.encryption.key_derivation_salt = ENV['ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT']
|
68
|
+
```
|
69
|
+
|
70
|
+
And then populate those ENV variables by whatever means you use. (Maybe setting them in `.env` or possibly exporting them directly.)
|
71
|
+
|
72
|
+
After you have things working in development you'll need to follow the same process for your production environment, and any others.
|
data/lib/bullet_train/version.rb
CHANGED
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.7.
|
4
|
+
version: 1.7.14
|
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-06-
|
11
|
+
date: 2024-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|