From 72c389161ab32da0ba4621e31bf63688c25372cc Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Fri, 27 Sep 2024 14:42:37 +0200 Subject: [PATCH] remove filter using generic add_filter methods --- .../procedures/_dossiers_filter_tags.html.haml | 12 +++++++++--- spec/system/instructeurs/procedure_filters_spec.rb | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/views/instructeurs/procedures/_dossiers_filter_tags.html.haml b/app/views/instructeurs/procedures/_dossiers_filter_tags.html.haml index 855e52f05..b8673ed2f 100644 --- a/app/views/instructeurs/procedures/_dossiers_filter_tags.html.haml +++ b/app/views/instructeurs/procedures/_dossiers_filter_tags.html.haml @@ -6,6 +6,12 @@ - filters.each_with_index do |filter, i| - if i > 0 = " ou " - = link_to remove_filter_instructeur_procedure_path(procedure, { statut: statut, column: filter.column.id, value: filter.filter }), - class: "fr-tag fr-tag--dismiss fr-my-1w", aria: { label: "Retirer le filtre #{filter.column.label}" } do - = "#{filter.column.label.truncate(50)} : #{procedure_presentation.human_value_for_filter(filter)}" + = form_tag(add_filter_instructeur_procedure_path(procedure), class: 'inline') do + - prefix = procedure_presentation.filters_name_for(statut) + = hidden_field_tag "#{prefix}[]", '' + - (current_filters - [filter]).each do |f| + = hidden_field_tag "#{prefix}[][id]", f.column.id + = hidden_field_tag "#{prefix}[][filter]", f.filter + + = button_tag "#{filter.column.label.truncate(50)} : #{procedure_presentation.human_value_for_filter(filter)}", + class: 'fr-tag fr-tag--dismiss fr-my-1w' diff --git a/spec/system/instructeurs/procedure_filters_spec.rb b/spec/system/instructeurs/procedure_filters_spec.rb index c8b588c89..85555764f 100644 --- a/spec/system/instructeurs/procedure_filters_spec.rb +++ b/spec/system/instructeurs/procedure_filters_spec.rb @@ -224,7 +224,7 @@ describe "procedure filters" do end def remove_filter(filter_value) - click_link text: filter_value + click_button text: filter_value end def add_column(column_name)