rend accessible la personnalisation des filtres instructeurs

en remplaçant select2 par ComboMultipleDropdownList
This commit is contained in:
Christophe Robillard 2021-02-11 15:32:00 +01:00 committed by Paul Chavard
parent c855d13994
commit 3fc7b57b8c
3 changed files with 7 additions and 9 deletions

View file

@ -138,7 +138,7 @@ module Instructeurs
end
def update_displayed_fields
procedure_presentation.update_displayed_fields(params[:values])
procedure_presentation.update_displayed_fields(JSON.parse(params[:values]))
redirect_back(fallback_location: instructeur_procedure_url(procedure))
end

View file

@ -122,10 +122,10 @@
Personnaliser
#custom-menu.dropdown-content.fade-in-down
= form_tag update_displayed_fields_instructeur_procedure_path(@procedure), method: :patch, class: 'dropdown-form columns-form' do
= select_tag :values,
options_for_select(@displayed_fields_options, selected: @displayed_fields_selected),
multiple: true,
class: 'select2-limited'
- hidden_field_id = SecureRandom.uuid
= hidden_field_tag :values, nil, data: { uuid: hidden_field_id }
= react_component("ComboMultipleDropdownList", options: @displayed_fields_options, selected: @displayed_fields_selected, disabled: [], hiddenFieldId: hidden_field_id, label: 'colonne')
= submit_tag "Enregistrer", class: 'button'
%tbody

View file

@ -125,15 +125,13 @@ feature "procedure filters" do
def add_column(column_name)
click_on 'Personnaliser'
find("span.select2-container").click
find(:xpath, "//li[text()='#{column_name}']").click
select_multi('colonne', column_name)
click_button "Enregistrer"
end
def remove_column(column_name)
click_on 'Personnaliser'
find(:xpath, "//li[contains(@title, '#{column_name}')]/span[contains(text(), '×')]").click
find(:xpath, "//form[contains(@class, 'columns-form')]//span[contains(@class, 'select2-container')]").click
find(:xpath, "//li[contains(text(), '#{column_name}')]/span[contains(text(), 'x')]").click
click_button "Enregistrer"
end
end