split filter in 2 partials too display filters tags on its own div to have more spaces
This commit is contained in:
parent
d856969790
commit
7abf51ca81
8 changed files with 32 additions and 27 deletions
|
@ -1,15 +0,0 @@
|
|||
%span.dropdown{ data: { controller: 'menu-button', popover: 'true' } }
|
||||
%button.fr-btn.fr-btn--secondary.fr-btn--sm.fr-mr-1w.dropdown-button{ data: { menu_button_target: 'button' } }
|
||||
= t('views.instructeurs.dossiers.filters.title')
|
||||
#filter-menu.dropdown-content.left-aligned.fade-in-down{ data: { menu_button_target: 'menu' } }
|
||||
= render Dossiers::FilterComponent.new(procedure: procedure, procedure_presentation: @procedure_presentation, statut: statut)
|
||||
|
||||
- current_filters.group_by { |filter| filter['table'] }.each_with_index do |(table, filters), i|
|
||||
- if i > 0
|
||||
= " et "
|
||||
- filters.each_with_index do |filter, i|
|
||||
- if i > 0
|
||||
= " ou "
|
||||
= link_to remove_filter_instructeur_procedure_path(procedure, { statut: statut, field: "#{filter['table']}/#{filter['column']}", value: filter['value'] }),
|
||||
class: "fr-tag fr-tag--dismiss fr-mb-1w", aria: { label: "Retirer le filtre #{filter['column']}" } do
|
||||
= "#{filter['label'].truncate(50)} : #{procedure_presentation.human_value_for_filter(filter)}"
|
|
@ -0,0 +1,5 @@
|
|||
%span.dropdown{ data: { controller: 'menu-button', popover: 'true' } }
|
||||
%button.fr-btn.fr-btn--secondary.fr-btn--sm.fr-mr-2w.dropdown-button{ data: { menu_button_target: 'button' } }
|
||||
= t('views.instructeurs.dossiers.filters.title')
|
||||
#filter-menu.dropdown-content.left-aligned.fade-in-down{ data: { menu_button_target: 'menu' } }
|
||||
= render Dossiers::FilterComponent.new(procedure: procedure, procedure_presentation: @procedure_presentation, statut: statut)
|
|
@ -0,0 +1,11 @@
|
|||
- if current_filters.count > 0
|
||||
.fr-mb-2w
|
||||
- current_filters.group_by { |filter| filter['table'] }.each_with_index do |(table, filters), i|
|
||||
- if i > 0
|
||||
= " et "
|
||||
- filters.each_with_index do |filter, i|
|
||||
- if i > 0
|
||||
= " ou "
|
||||
= link_to remove_filter_instructeur_procedure_path(procedure, { statut: statut, field: "#{filter['table']}/#{filter['column']}", value: filter['value'] }),
|
||||
class: "fr-tag fr-tag--dismiss fr-mb-1w", aria: { label: "Retirer le filtre #{filter['column']}" } do
|
||||
= "#{filter['label'].truncate(50)} : #{procedure_presentation.human_value_for_filter(filter)}"
|
|
@ -56,10 +56,11 @@
|
|||
|
||||
.fr-container--fluid.fr-mx-4w.overflow-y-visible
|
||||
%hr
|
||||
.flex.fr-mb-2w
|
||||
.flex.align-center
|
||||
- if @filtered_sorted_paginated_ids.present? || @current_filters.count > 0
|
||||
= render partial: "dossiers_filter_dropdown", locals: { procedure: @procedure, statut: @statut}
|
||||
= render Dossiers::NotifiedToggleComponent.new(procedure: @procedure, procedure_presentation: @procedure_presentation)
|
||||
|
||||
= render partial: "dossiers_filter", locals: { procedure: @procedure, procedure_presentation: @procedure_presentation, current_filters: @current_filters, statut: @statut, filterable_fields_for_select: @filterable_fields_for_select }
|
||||
.fr-ml-auto
|
||||
%span.dropdown{ data: { controller: 'menu-button', popover: 'true' } }
|
||||
%button.fr-btn.fr-btn--sm.fr-btn--secondary.dropdown-button.fr-ml-1w{ data: { menu_button_target: 'button' } }
|
||||
|
@ -87,6 +88,8 @@
|
|||
= render Dossiers::ExportComponent.new(procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count, export_url: method(:download_export_instructeur_procedure_path))
|
||||
|
||||
- if @filtered_sorted_paginated_ids.present? || @current_filters.count > 0
|
||||
= render partial: "dossiers_filter_tags", locals: { procedure: @procedure, procedure_presentation: @procedure_presentation, current_filters: @current_filters, statut: @statut }
|
||||
|
||||
- batch_operation_component = Dossiers::BatchOperationComponent.new(statut: @statut, procedure: @procedure)
|
||||
|
||||
- if @batch_operations.present?
|
||||
|
@ -97,7 +100,7 @@
|
|||
.flex.align-center
|
||||
%span.fr-h6.fr-mb-0.fr-mr-2w
|
||||
= t('views.instructeurs.dossiers.dossiers_count', count: @dossiers_count)
|
||||
= render Dossiers::NotifiedToggleComponent.new(procedure: @procedure, procedure_presentation: @procedure_presentation)
|
||||
|
||||
= render batch_operation_component
|
||||
.fr-table.fr-table--bordered
|
||||
%table.table.dossiers-table.hoverable
|
||||
|
|
|
@ -221,6 +221,7 @@ en:
|
|||
enabled: "Add this file to the selection for the bulk operation"
|
||||
disabled: "Impossible to add this file to the selection because it is already in a bulk operation"
|
||||
dossiers_count:
|
||||
zero: 0 file
|
||||
one: 1 file
|
||||
other: "%{count} files"
|
||||
personalize: Personalize the table
|
||||
|
|
|
@ -217,6 +217,7 @@ fr:
|
|||
enabled: "Ajouter ce dossier à la selection pour un traitement de masse"
|
||||
disabled: "Impossible d'ajouter ce dossier à la selection car il est déjà dans un traitement de masse"
|
||||
dossiers_count:
|
||||
zero: 0 dossier
|
||||
one: 1 dossier
|
||||
other: "%{count} dossiers"
|
||||
show_deleted_dossiers: Afficher les dossiers supprimés
|
||||
|
|
|
@ -14,20 +14,19 @@ RSpec.describe Dossiers::BatchOperationComponent, type: :component do
|
|||
subject { render_inline(component).to_html }
|
||||
context 'statut traite' do
|
||||
let(:statut) { 'traites' }
|
||||
it { is_expected.to have_button('Archiver les dossiers sélectionnés', disabled: true) }
|
||||
it { is_expected.to have_button('Archiver les dossiers', disabled: true) }
|
||||
end
|
||||
|
||||
subject { render_inline(component).to_html }
|
||||
context 'statut suivis' do
|
||||
let(:statut) { 'suivis' }
|
||||
it { is_expected.to have_button('Actions multiples', disabled: true) }
|
||||
it { is_expected.to have_button('Passer en instruction les dossiers sélectionnés', disabled: true) }
|
||||
it { is_expected.to have_link('Accepter les dossiers sélectionnés') }
|
||||
it { is_expected.to have_button('Passer en instruction les dossiers', disabled: true) }
|
||||
it { is_expected.to have_button('Accepter les dossiers', disabled: true) }
|
||||
end
|
||||
|
||||
context 'statut a-suivre' do
|
||||
let(:statut) { 'a-suivre' }
|
||||
it { is_expected.to have_button('Suivre les dossiers sélectionnés', disabled: true) }
|
||||
it { is_expected.to have_button('Suivre les dossiers', disabled: true) }
|
||||
end
|
||||
|
||||
context 'statut tous' do
|
||||
|
|
|
@ -23,15 +23,15 @@ describe 'BatchOperation a dossier:', js: true do
|
|||
# check a11y with enabled checkbox
|
||||
expect(page).to be_axe_clean
|
||||
# ensure button is disabled by default
|
||||
expect(page).to have_button("Archiver les dossiers sélectionnés", disabled: true)
|
||||
expect(page).to have_button("Archiver les dossiers", disabled: true)
|
||||
|
||||
checkbox_id = dom_id(BatchOperation.new, "checkbox_#{dossier_1.id}")
|
||||
# batch one dossier
|
||||
check(checkbox_id)
|
||||
expect(page).to have_button("Archiver les dossiers sélectionnés")
|
||||
expect(page).to have_button("Archiver les dossiers")
|
||||
|
||||
# ensure batch is created
|
||||
expect { click_on "Archiver les dossiers sélectionnés" }
|
||||
expect { click_on "Archiver les dossiers" }
|
||||
.to change { BatchOperation.count }
|
||||
.from(0).to(1)
|
||||
|
||||
|
@ -67,7 +67,7 @@ describe 'BatchOperation a dossier:', js: true do
|
|||
end
|
||||
|
||||
# submnit checkall
|
||||
expect { click_on "Archiver les dossiers sélectionnés" }
|
||||
expect { click_on "Archiver les dossiers" }
|
||||
.to change { BatchOperation.count }
|
||||
.from(1).to(2)
|
||||
|
||||
|
|
Loading…
Reference in a new issue