bullet_train 1.0.37 → 1.0.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/sessions/controller_base.rb +11 -7
- data/app/views/layouts/docs.html.erb +1 -1
- data/docs/indirection.md +2 -52
- data/docs/overriding.md +53 -0
- data/lib/bullet_train/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d8dd0b6a816a73fcf98800e8416fadbbe71bf5836657a1b4344a8cf85d9f4cb
|
4
|
+
data.tar.gz: 2a92723e1cf1bdf01be90564f85dd45d0168a6ef834c2b244c98bd74b62b7e4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7365104ebdbd0382bb2e040342c6ee83848c60fce20c4be6a1ababf0514e1f482ffe8c9fa5f07e717321b02051d434da754ef54b2d69258694a5545be4d60e43
|
7
|
+
data.tar.gz: b0e7f1cc4aa3230e8a626700ef856806e45d9e09c003be4ad642a4dd132fe1499d92c5cde8eaca8a2b31f75045a056cbfaa16e5023370ceb42240a9e0f606868
|
@@ -2,14 +2,18 @@ module Sessions::ControllerBase
|
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
4
|
included do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
# TODO I'm not sure why the sign-in page started throwing a `ActionController::InvalidAuthenticityToken`. I'm doing
|
6
|
+
# this as a temporary workaround, but this shouldn't be here long-term.
|
7
|
+
skip_before_action :verify_authenticity_token, only: [:create]
|
8
|
+
end
|
9
|
+
|
10
|
+
def pre_otp
|
11
|
+
if (@email = params["user"]["email"].downcase.strip.presence)
|
12
|
+
@user = User.find_by(email: @email)
|
13
|
+
end
|
9
14
|
|
10
|
-
|
11
|
-
|
12
|
-
end
|
15
|
+
respond_to do |format|
|
16
|
+
format.js
|
13
17
|
end
|
14
18
|
end
|
15
19
|
end
|
@@ -83,7 +83,7 @@
|
|
83
83
|
<%= render 'account/shared/menu/section', title: 'General Topics' do %>
|
84
84
|
<%= render 'account/shared/menu/item', url: '/docs/modeling', label: 'Domain Modeling' do |p| %>
|
85
85
|
<% p.content_for :icon do %>
|
86
|
-
<i class="fal fa-bolt ti ti-
|
86
|
+
<i class="fal fa-bolt ti ti-ruler-pencil"></i>
|
87
87
|
<% end %>
|
88
88
|
<% end %>
|
89
89
|
|
data/docs/indirection.md
CHANGED
@@ -1,53 +1,3 @@
|
|
1
|
-
#
|
1
|
+
# Overriding Framework Defaults
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
In software development, indirection is everywhere and takes many forms.
|
6
|
-
|
7
|
-
For example, in vanilla Rails development, you introduce a type of indirection when you extract a button label out of a view file and use the `t` helper to render the string from a translation YAML file. In the future, when another developer goes to update the button label, they will first open the view, they'll see `t(".submit")` and then have to reason a little bit about which translation file they need to open up in order to update that label.
|
8
|
-
|
9
|
-
Our goal in Bullet Train is to improve developer experience, not reduce it, so it was important that along with any instances of indirection we were introducing, we also included new tooling to ensure it was never a burden to developers. Thankfully, in practice we found that some of this new tooling improves even layers of indirection that have always been with us in Rails development.
|
10
|
-
|
11
|
-
## Solving Indirection in Views
|
12
|
-
|
13
|
-
### Resolving Partial Paths with `bin/resolve`
|
14
|
-
|
15
|
-
Even in vanilla Rails development, when you're looking at a view file, the path you see passed to a `render` call isn't the actual file name of the partial that will be rendered. This is even more true in Bullet Train where certain partial paths are [magically served from theme gems](/docs/themes.md).
|
16
|
-
|
17
|
-
`bin/resolve` makes it easy to figure out where where a partial is being served from:
|
18
|
-
|
19
|
-
```
|
20
|
-
$ bin/resolve shared/box
|
21
|
-
```
|
22
|
-
|
23
|
-
### Exposing Rendered Views with Xray
|
24
|
-
|
25
|
-
> TODO Is this still true in Rails 7? Does it not do something like this by default now?
|
26
|
-
|
27
|
-
If you're looking at a rendered view in the browser, it can be hard to know which file to open in order to make a change. To help, Bullet Train includes [Xray](https://github.com/brentd/xray-rails) by default, so you can right click on any element you see, select "Inspect Element", and you'll see comments in the HTML source telling you which file is powering a particular portion of the view, like this:
|
28
|
-
|
29
|
-
```
|
30
|
-
<!--XRAY START 90 /Users/andrewculver/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bullet_train-themes-light-1.0.10/app/views/themes/light/workflow/_box.html.erb-->
|
31
|
-
```
|
32
|
-
|
33
|
-
Note that in the example above, the view in question isn't actually coming from the application repository. Instead, it's being included from the `bullet_train-themes-light` package. For instructions on how to customize it, see [Overriding the Framework](/docs/override).
|
34
|
-
|
35
|
-
### Drilling Down on Translation Keys
|
36
|
-
|
37
|
-
Even in vanilla Rails applications, extracting strings from view files into I18N translation YAML files introduces a layer of indirection. Bullet Train tries to improve the resulting DX with a couple tools that make it easier to figure out where a translation you see in your browser is coming from.
|
38
|
-
|
39
|
-
#### Show Translation Keys in the Browser with `?show_locales=true`
|
40
|
-
|
41
|
-
You can see the full translation key of any string on the page by adding `?show_locales=true` to the URL.
|
42
|
-
|
43
|
-
#### Log Translation Keys to the Console with `?log_locales=true`
|
44
|
-
|
45
|
-
You can also log all the translation key for anything being rendered to the console by adding `?log_locales=true` to the request URL. This can make it easier to copy and paste translation keys for strings that are rendered in non-selectable UI elements.
|
46
|
-
|
47
|
-
#### Resolving Translation Keys with `bin/resolve`
|
48
|
-
|
49
|
-
Once you have the full I18N translation key, you can use `bin/resolve` to figure out which package and file it's coming from. At that point, if you need to customize it, you can also use the `--eject` option to copy the the framework for customization in your local application:
|
50
|
-
|
51
|
-
```
|
52
|
-
$ bin/resolve en.account.onboarding.user_details.edit.header --eject --open
|
53
|
-
```
|
3
|
+
> TODO This section needs to be written.
|
data/docs/overriding.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Dealing with Indirection
|
2
|
+
|
3
|
+
## The Problem with Indirection
|
4
|
+
|
5
|
+
In software development, indirection is everywhere and takes many forms.
|
6
|
+
|
7
|
+
For example, in vanilla Rails development, you introduce a type of indirection when you extract a button label out of a view file and use the `t` helper to render the string from a translation YAML file. In the future, when another developer goes to update the button label, they will first open the view, they'll see `t(".submit")` and then have to reason a little bit about which translation file they need to open up in order to update that label.
|
8
|
+
|
9
|
+
Our goal in Bullet Train is to improve developer experience, not reduce it, so it was important that along with any instances of indirection we were introducing, we also included new tooling to ensure it was never a burden to developers. Thankfully, in practice we found that some of this new tooling improves even layers of indirection that have always been with us in Rails development.
|
10
|
+
|
11
|
+
## Solving Indirection in Views
|
12
|
+
|
13
|
+
### Resolving Partial Paths with `bin/resolve`
|
14
|
+
|
15
|
+
Even in vanilla Rails development, when you're looking at a view file, the path you see passed to a `render` call isn't the actual file name of the partial that will be rendered. This is even more true in Bullet Train where certain partial paths are [magically served from theme gems](/docs/themes.md).
|
16
|
+
|
17
|
+
`bin/resolve` makes it easy to figure out where where a partial is being served from:
|
18
|
+
|
19
|
+
```
|
20
|
+
$ bin/resolve shared/box
|
21
|
+
```
|
22
|
+
|
23
|
+
### Exposing Rendered Views with Xray
|
24
|
+
|
25
|
+
> TODO Is this still true in Rails 7? Does it not do something like this by default now?
|
26
|
+
|
27
|
+
If you're looking at a rendered view in the browser, it can be hard to know which file to open in order to make a change. To help, Bullet Train includes [Xray](https://github.com/brentd/xray-rails) by default, so you can right click on any element you see, select "Inspect Element", and you'll see comments in the HTML source telling you which file is powering a particular portion of the view, like this:
|
28
|
+
|
29
|
+
```
|
30
|
+
<!--XRAY START 90 /Users/andrewculver/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bullet_train-themes-light-1.0.10/app/views/themes/light/workflow/_box.html.erb-->
|
31
|
+
```
|
32
|
+
|
33
|
+
Note that in the example above, the view in question isn't actually coming from the application repository. Instead, it's being included from the `bullet_train-themes-light` package. For instructions on how to customize it, see [Overriding the Framework](/docs/override).
|
34
|
+
|
35
|
+
### Drilling Down on Translation Keys
|
36
|
+
|
37
|
+
Even in vanilla Rails applications, extracting strings from view files into I18N translation YAML files introduces a layer of indirection. Bullet Train tries to improve the resulting DX with a couple tools that make it easier to figure out where a translation you see in your browser is coming from.
|
38
|
+
|
39
|
+
#### Show Translation Keys in the Browser with `?show_locales=true`
|
40
|
+
|
41
|
+
You can see the full translation key of any string on the page by adding `?show_locales=true` to the URL.
|
42
|
+
|
43
|
+
#### Log Translation Keys to the Console with `?log_locales=true`
|
44
|
+
|
45
|
+
You can also log all the translation key for anything being rendered to the console by adding `?log_locales=true` to the request URL. This can make it easier to copy and paste translation keys for strings that are rendered in non-selectable UI elements.
|
46
|
+
|
47
|
+
#### Resolving Translation Keys with `bin/resolve`
|
48
|
+
|
49
|
+
Once you have the full I18N translation key, you can use `bin/resolve` to figure out which package and file it's coming from. At that point, if you need to customize it, you can also use the `--eject` option to copy the the framework for customization in your local application:
|
50
|
+
|
51
|
+
```
|
52
|
+
$ bin/resolve en.account.onboarding.user_details.edit.header --eject --open
|
53
|
+
```
|
data/lib/bullet_train/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.40
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
@@ -552,6 +552,7 @@ files:
|
|
552
552
|
- docs/namespacing.md
|
553
553
|
- docs/oauth.md
|
554
554
|
- docs/onboarding.md
|
555
|
+
- docs/overriding.md
|
555
556
|
- docs/permissions.md
|
556
557
|
- docs/seeds.md
|
557
558
|
- docs/super-scaffolding.md
|