-
Notifications
You must be signed in to change notification settings - Fork 51
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
Update field partials for correct use of options variables #633
Conversation
I went ahead and deleted |
We'll have to look over this block to make sure we're scaffolding bullet_train-core/bullet_train-super_scaffolding/lib/scaffolding/transformer.rb Lines 739 to 747 in cdccbdd
EDIT: |
Still a handful of partials to work through, but I'm hoping to get this one over the finish line sometime next week. I'm foreseeing the following partials being a little difficult to adjust:
|
Managed to get the cloudinary image partial and color picker partial out of the way today, only a few more partials left. One thing to note is that color picker options were being housed like this: Other places, like the button partial, simply put the array of values into |
@jagthedrummer This PR is done for the most part, so I marked it for review as I think over how to add documentation for upgrading to the next version. I know you did a lot of upgrading docs before, so any insight would be helpful. I also have left the Besides the docs, I'll look over things one more time to see what I can clean up. |
I've been pretty tied up this week and haven't had a chance to look at this. I'll give it a good review next week. Thanks for taking this on, @gazayas! |
@jagthedrummer No problem at all! Just as a point of reference, here is the main method that calls the Rails form helpers, which is what I think we should base bullet_train-core/bullet_train-themes-light/app/views/themes/light/fields/_field.html.erb Lines 69 to 81 in 6d2ca8a
|
@@ -754,7 +742,7 @@ def valid_#{attribute.collection_name} | |||
|
|||
# https://stackoverflow.com/questions/21582464/is-there-a-ruby-hashto-s-equivalent-for-the-new-hash-syntax | |||
if field_options.any? || options.any? | |||
field_options_key = if ["buttons", "super_select", "options"].include?(attribute.type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super Select is the only partial that uses html_options
under the hood, whereas buttons and options simply use options
(all the BT-side invocations in this comment are taken from main
).
Super Select:
Buttons:
Options:
# TODO: Partials which invoke form helpers inline aren't using | ||
# these classes, although we have the `has_errors` conditional with some style below. | ||
options[:class] = "#{options[:class]} block w-full rounded-md shadow-sm font-light text-sm dark:bg-slate-800 dark:text-slate-300" | ||
|
||
options[:class] += if has_errors | ||
" pr-10 border-red-500 text-red-900 placeholder-red-500 outline-none focus:ring-red-500 focus:border-red-500 dark:text-slate-300" | ||
else | ||
" focus:ring-primary-500 focus:border-primary-500 border-slate-300 dark:border-slate-900" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've only edited comments for these last three commits and the tests started to fail, it looks like the Open API tests are acting up again. EDIT:
|
One more note before I call it a day. I decided to pass all
I think we can find a way around these two issues and eventually remove |
Just a note for myself that we want to wait to merge this until the following things have happened:
Update: The fix was release in |
I added some more documentation explaining |
@gazayas it looks like the rails fix that we were waiting on was released a couple of days ago in |
@jagthedrummer It's been a hot minute so there are going to be a lot of commits from the merge here, but the only conflict was from the update in #742 so it shouldn't be too bad. Also, super scaffolding system tests passed locally for me. |
Ah, it just consolidated everything into the merge: 54518e4 Alright, good to go! |
Linter... |
Hmm, the linter's still failing, I'll need to look at this one in a little more depth. |
Looks like a Ruby version issue. I'll have to swing back to this one in a little bit, will ping you again soon:
|
@jagthedrummer I didn't tag you earlier when I merged the latest changes with |
@gazayas, I'm so sorry that I missed your update on this a couple of months ago. It looks like we have some more conflicts now. 😞 For some reason GitHub isn't letting me resolve them in the browser, so I just took a stab at rebasing all of this locally. I pushed it to a new branch and am letting CI run. https://github.com/bullet-train-co/bullet_train-core/pull/799/files If that PR looks right (and if CI passes) I can push that branch onto this PR. Sorry that I let this hang out so long. 🤦 |
@jagthedrummer No problem! I just merged If you still want me to look at the rebase PR you submitted, I'd be glad to look at it. |
Nah, don't worry about that other PR @gazayas. I'll go ahead and close that one now, and then this PR will be on the top of my list to get merged next week. Thanks again! |
OK, @gazayas I just did some testing with this and we're getting really close! Here's what I did to test: First I had my starter repo using the released versions of all the gems, and then I generated a
Then I ran And then I visited the form for editing a project, and I see two pairs (four total) deprecation messages in the log:
As happened previously the warnings point to After doing that the deprecation messages look like this:
So the deprecation warnings that we're raising are now being reported from the right place ( Looks like instead of doing this: ActiveSupport::Deprecation.warn("our message") We should do something more like this: ActiveSupport::Deprecation.new.warn("our message") |
I just made the change mentioned above. Gonna let CI run, and then merge this sucker. Thanks for your work on this @gazayas! It's definitely going to make the whole |
Thanks for picking up that last part on the deprecation warnings! I saw that there's a merge conflict (?) on #801 so I'll take a glance at that one, glad this one is merged though! |
In #633 we standardized the way that we pass various options to various field partials. It looks like we had some confusion about whether we were using `buttion_field_options` or `button_field_buttons` as the new variable name. We were using both in difference spots, but they didn't agree so it just didn't work. This PR standardizes on `button_field_options` to match the pattern that we're using in other field partials. It removes `button_field_buttons`. Fixes #815
Closes #631.
The current state of this PR doesn't change the use of
options
andhtml_options
, but it does remove them from render calls where they aren't necessary. I've added comments to those invocations to make the PR easier to review, but we can delete them later if we decide we don't need them.options
vshtml_options
options
orhtml_options
where necessary inbullet_train-themes
partialsoptions
orhtml_options
where necessary inbullet_train-themes-tailwind-css
partialsother_options
tobt_options
There are a lot of tasks here, so I'm okay with breaking down this one into pieces if we need to.
_field.html.erb
These two files are seemingly the same, so I wonder if we can consolidate this all into one file.
EDIT:
The tailwind_css field partial was a duplicate, so I deleted it here f3fdcee