-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor flashes [WIP - Questions] #455
base: main
Are you sure you want to change the base?
Conversation
Just a couple of thoughts: In this and a few other PRs, the class values have been re-ordered (I imagine with some kind of editor plugin like prettier). This makes the PRs very noisy and hard to read, so it's harder to give feedback on what's meaningfully changed. I'm generally in favor of ordering them sensibly, but can you either avoid committing those changes to PRs, or else just give us one big PR with all the class ordering changes in it? I'm not sure why I think I like the idea of having a |
1f0be53
to
d1abd37
Compare
this is the PR that added the flex class: https://github.com/rails/tailwindcss-rails/pull/71/files#diff-82d31adf98ad40bfa67ed05464d36790777703adead66a2478d97320061f136c There's no explanation why it should be a flex container though. |
The code that displays flashes is repeated a few times in the scaffold and authentication generators.
When you run the generators, you normally end up extracting those lines into a separate partial. This PR aims to simplify that process by creating the
app/views/application/_flashes.html.erb
partial that is shared for the entire app when runningrails g authentication
orrails g scaffold ...
. Once you have it, you can customize it to your needs and the next time the generators are run, you'll be prompted to leave it or overwrite it, etc.An alternative to this (creating the file when running the generators) would be to create the partial when running
rails tailwindcss:install
and insert it right into the layout. tbh I like this approach better, but if we go that way we have a few issues:tailwindcss:install
task adds theflex
class to the layout's main container, so we'd have to remove it. Not sure why it's added in the first place but it might be a problem.w-2/3
class, meaning the flash would be left-aligned while the session/password form would be centered. we'd end up adding a condition to the flash like "make it w-2/3 and mx-auto if it's the session or passwords controller", which is far from ideal.What do you think?
The whole point of this PR and my previous ones are to make the scaffold generator as "ready to use" as possible without many modifications. Hope it makes sense 🙂