app/helpers/alchemy/custom/model/admin/base_helper.rb in alchemy-custom-model-2.2.0 vs app/helpers/alchemy/custom/model/admin/base_helper.rb in alchemy-custom-model-2.2.1

- old
+ new

@@ -435,6 +435,51 @@ el_buf end end + def search_panel(options = {}, &block) + submit_button = options.fetch(:enable_submit, true) + klass = options.delete(:class) || [] + + content_tag(:div, class: "search_panel #{klass.join(" ")}", ** options) do + sb = ActiveSupport::SafeBuffer.new + + if @query + sb << content_tag(:div, class:"title") do + spt = ActiveSupport::SafeBuffer.new + spt << content_tag(:span, t("search_panel_title"), class:"title_label") + + #TODO: toggle pannello + #spt << content_tag(:span, class:"button_toggle") do + # content_tag(:a,class:"icon_button") do + # content_tag(:i, nil, class:"icon fa-fw fa-bars fas") + # end + #end + spt + end + + sb << simple_form_for(@query, url: polymorphic_path([:admin, @query.klass]), method: :get) do |f| + sff = ActiveSupport::SafeBuffer.new + + sff << content_tag(:div, class: "search_fields_group") do + search_fields = ActiveSupport::SafeBuffer.new + + search_fields << capture do + block.call(f) + end + + search_fields + end + if submit_button + sff << content_tag(:div, class: "action_buttons") do + f.submit(::I18n.t('alchemy_ajax_form.submit_search')) + end + end + sff + end + end + sb + end + end + end \ No newline at end of file