diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4042152fd..88a257664 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -163,14 +163,14 @@ module ApplicationHelper submit_tag("Preview", "data-input-id" => options[:input_id], "data-preview-id" => options[:preview_id]) end - def search_field(method, options = {}) - name = options[:label] || method.titleize - string = '
' - if options[:hint] - string += '

' + options[:hint] + '

' + def search_field(method, label: method.titleize, hint: nil, value: nil, **attributes) + content_tag(:div, class: "input") do + label_html = label_tag("search_#{method}", label) + input_html = text_field_tag(method, value, id: "search_#{method}", name: "search[#{method}]", **attributes) + hint_html = hint.present? ? content_tag(:p, hint, class: "hint") : "" + + label_html + input_html + hint_html end - string += '
' - string.html_safe end def body_attributes(user = CurrentUser.user)