Skip to content

Commit

Permalink
Move hidden before input
Browse files Browse the repository at this point in the history
  • Loading branch information
nimmolo committed Jun 23, 2024
1 parent 46623ef commit 133e91b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/helpers/forms_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,11 @@ def autocompleter_field(**args)
ac_args[:wrap_data] = { controller: :autocompleter, type: args[:type],
separator: args[:separator],
autocompleter_target: "wrap" }
ac_args[:append] = capture do
ac_args[:between] = capture do
concat(autocompleter_hidden_field(**args)) if args[:form]
concat(args[:between])
end
ac_args[:append] = capture do
concat(autocompleter_dropdown)
concat(args[:append])
end
Expand Down Expand Up @@ -196,8 +199,8 @@ def autocompleter_dropdown

def autocompleter_hidden_field(**args)
type = autocompleter_type_to_model(args[:type])
args[:form].hidden_field(:"#{type}_id",
data: { autocompleter_target: "hidden" })
args[:form].text_field(:"#{type}_id",
data: { autocompleter_target: "hidden" })
end

def autocompleter_type_to_model(type)
Expand Down

0 comments on commit 133e91b

Please sign in to comment.