views: fix search forms to retain limit param.

Fix search forms to retain the `limit` URL param if it was manually given in the URL.
This commit is contained in:
evazion
2022-09-15 03:21:19 -05:00
parent 25739d9e29
commit 86b2d25f21

View File

@@ -253,7 +253,12 @@ module ApplicationHelper
defaults = { required: false }
html_options = { autocomplete: "off", class: "search-form #{classes}" }
simple_form_for(:search, method: method, url: url, defaults: defaults, html: html_options, &block)
simple_form_for(:search, method: method, url: url, defaults: defaults, html: html_options) do |f|
out = "".html_safe
out += tag.input(type: :hidden, name: :limit, value: params[:limit]) if params[:limit].present?
out += capture { yield f } if block_given?
out
end
end
def edit_form_for(model, **options, &block)