Skip to content
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

UI of nested field get weird after pushed "Add a new ..." button #3528

Closed
ha4gu opened this issue Jun 6, 2022 · 2 comments
Closed

UI of nested field get weird after pushed "Add a new ..." button #3528

ha4gu opened this issue Jun 6, 2022 · 2 comments

Comments

@ha4gu
Copy link

ha4gu commented Jun 6, 2022

Describe the bug

The UI of nested field for has_many association won't work properly on Rails Admin 3.0.0.
After pushed "Add a new ..." button, you would find two strange points:

  • The width of instance tabs broadly extends, as wide as other input field.
  • The nested field won't be closed; it would show up just after toggled up.

These behaviors occur in these cases:

  • Create (new) view

new-failed

  • Update (edit) view, if you push add button without opening the field beforehand

edit-failed

Not occur (works properly) in this case:

  • Update (edit) view, if you push add button after opening the field at first

edit-ok

Reproduction steps

It's easy to reproduce this behavior; Simply create two models connected with has_many/belongs_to association.
Here is my examples.

app/models/author.rb

class Author < ApplicationRecord
  has_many :books, dependent: :destroy
  accepts_nested_attributes_for :books
end

app/models/book.rb

class Book < ApplicationRecord
  belongs_to :author
end

config/initializers/rails_admin.rb

RailsAdmin.config do |config|
  config.asset_source = :webpacker

  config.actions do
    ((snip))
  end

  config.included_models = ['Author', 'Book']

  config.model 'Book' do
    include_fields :title
  end
end

Expected behavior

In the UI of nested field,

  • The width of instance tabs is fit to the length of strings inside, not fully expanded.
  • The nested field would be opened and then closed when toggle button is switched.

Additional context

  • rails version: 6.1.6
  • rails_admin version: 3.0.0, and also current master (652418c)
  • rails_admin npm package version: 3.0.0, and also current master (652418c)
@mshibuya
Copy link
Member

Thanks for reporting, fixed by d1f1154.

@ha4gu
Copy link
Author

ha4gu commented Jun 26, 2022

I appreciate it! Now I confirmed the current master branch nicely resolved this issue. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants