[v4.5] [Admin] Fix Unclosed form_tag in table component#6182
Merged
Conversation
This PR fixes an HTML structure break caused by an unclosed form_tag, ensuring that forms added after using ui/table are rendered correctly.
## Background
While customizing the index page to add a new form, I encountered a problem where the added form was not displayed in the browser. Upon investigation, I discovered that the issue stemmed from the form_tag in ui/table/component.html.erb not being explicitly closed, which resulted in subsequent form tags disappearing.
``` rb
<%= render component("ui/table/toolbar").new("data-#{stimulus_id}-target": "batchToolbar", role: "toolbar", "aria-label": t(".batch_actions"), hidden: true) do %>
<%= form_tag '', id: batch_actions_form_id %>
<% @data.batch_actions.each do |batch_action| %>
<%= render_batch_action_button(batch_action) %>
<% end %>
<% end %>
```
Due to the lack of a proper block structure closing the form_tag, the HTML became malformed, and any form tags declared afterward were not rendered.
Updated the form_tag to use a block form, ensuring that the opening and closing tags are explicitly defined.
(cherry picked from commit 6949386)
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
maintov4.5:Questions ?
Please refer to the Backport tool documentation