remove filter using generic add_filter methods

This commit is contained in:
simon lehericey 2024-09-27 14:42:37 +02:00
parent 175f303399
commit 72c389161a
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
2 changed files with 10 additions and 4 deletions

View file

@ -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'

View file

@ -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)