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

fix: broken attach and attach another button for searchable associations #3457

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/views/avo/associations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@
stacked: true,
classes: 'w-full'
%>
<%= hidden_field_tag :turbo_frame, params[:turbo_frame] %>
<% end %>
<%#
It is important to render this hidden field to allow selective rendering of the turbo frame.
(e.g. in the case of "Attach and Attach Another")

Without this, the entire page will be reloaded when the form is submitted.
%>
Comment on lines +45 to +50
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Paul-Bob I added a comment here for communication purposes. LMK if it should be reworded or if this works. Thank you for your comment - I completely missed the hidden_field_tag!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you @ObiWanKeoni!

<%= hidden_field_tag :turbo_frame, params[:turbo_frame] %>
<% @attach_fields&.each_with_index do |field, index| %>
<%= render(Avo::Items::SwitcherComponent.new(
resource: @related_resource,
Expand Down
Loading