From da758ae457d62035fb5256c391b96e7cf3d2e871 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 29 Apr 2024 14:08:07 -0300 Subject: [PATCH] fix: poder pasar filtros entre formularios --- app/views/posts/index.haml | 4 ++++ app/views/sites/_header.haml | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index a555343b..129fc835 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -8,6 +8,10 @@ = render 'layouts/details', summary: t('posts.filters.title') do %form.border.border-magenta.p-1{method: :get} + - @filter_params.each do |param, values| + - next if param == :layout + - [values].flatten.each do |value| + %input{ type: 'hidden', name: values.is_a?(Array) ? "#{param}[]" : param, value: value } %legend.font-weight-bold.m-0.h6= 'Tipo de contenido' diff --git a/app/views/sites/_header.haml b/app/views/sites/_header.haml index c4936853..779ed543 100644 --- a/app/views/sites/_header.haml +++ b/app/views/sites/_header.haml @@ -2,9 +2,10 @@ %h1= site.title %p.lead= site.description %form.mb-3{ action: site_posts_path } - - @filter_params.each do |param, value| - - next if param == 'q' - %input{ type: 'hidden', name: param, value: value } + - @filter_params.each do |param, values| + - next if param == :q + - [values].flatten.each do |value| + %input{ type: 'hidden', name: values.is_a?(Array) ? "#{param}[]" : param, value: value } .form-group.flex-grow-0.m-0 %label{for: 'q'}= t('posts.index.search') .input-group