Skip to content

Commit 18bb4f7

Browse files
replace form_for override with custom form helper
1 parent 31fba13 commit 18bb4f7

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

app/views/resource/_form.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
form: "instance of Plutonium::UI::Builder::Form"
44
}
55
%>
6-
<%= simple_form_for adapt_route_args(form.record) do |f| %>
6+
<%= resource_form_for adapt_route_args(form.record) do |f| %>
77
<div class="row row-gap-2">
88
<div class="container">
99
<div class="form-errors">

app/views/resource/_interactive_resource_action_form.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<%= turbo_frame_tag "modal" do %>
88
<div class="modal " tabindex="-1" data-controller="modal">
99
<div class="modal-dialog modal-dialog-scrollable modal-lg">
10-
<%= simple_form_for @interaction, as: :interaction,
10+
<%= resource_form_for @interaction, as: :interaction,
1111
method: :post,
1212
turbo_frame: :modal,
1313
url: "" do |f| %>
@@ -42,7 +42,7 @@
4242
</div>
4343
<% end %>
4444
<% else%>
45-
<%= simple_form_for @interaction, as: :interaction, method: :post, url: "" do |f| %>
45+
<%= resource_form_for @interaction, as: :interaction, method: :post, url: "" do |f| %>
4646
<div class="row row-gap-2">
4747
<div class="container">
4848
<div class="form-errors">

lib/plutonium/helpers/form_helper.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ module Helpers
33
module FormHelper
44
include ActionView::Helpers::FormHelper
55

6-
alias_method :pu_overridden_form_for, :form_for
7-
86
#
97
# Override the original form_for helper to disable turbo forms by default if not
108
# explicitly opted into
119
#
12-
def form_for(record, options = {}, &block)
10+
def resource_form_for(record, options = {}, &block)
1311
turbo_frame = options.key?(:turbo_frame) ? options[:turbo_frame] : "_top"
1412
options = {
1513
html: {
@@ -19,7 +17,7 @@ def form_for(record, options = {}, &block)
1917
}
2018
}.deep_merge! options
2119

22-
pu_overridden_form_for(record, options, &block)
20+
simple_form_for(record, options, &block)
2321
end
2422
end
2523
end

0 commit comments

Comments
 (0)