move/rename faceting components within their instructeur ns

This commit is contained in:
mfo 2024-07-22 09:22:05 +02:00
parent 61051771a7
commit 31255b69cc
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
13 changed files with 30 additions and 6 deletions

View file

@ -1,4 +1,4 @@
class Dossiers::InstructeurFilterComponent < ApplicationComponent class Instructeurs::ColumnFilterComponent < ApplicationComponent
attr_reader :procedure, :procedure_presentation, :statut, :facet attr_reader :procedure, :procedure_presentation, :statut, :facet
def initialize(procedure:, procedure_presentation:, statut:, facet: nil) def initialize(procedure:, procedure_presentation:, statut:, facet: nil)

View file

@ -1,4 +1,4 @@
class Dossiers::InstructeurFacetPickerComponent < ApplicationComponent class Instructeurs::ColumnPickerComponent < ApplicationComponent
attr_reader :procedure, :procedure_presentation attr_reader :procedure, :procedure_presentation
def initialize(procedure:, procedure_presentation:) def initialize(procedure:, procedure_presentation:)

View file

@ -3,4 +3,4 @@
= t('views.instructeurs.dossiers.filters.title') = t('views.instructeurs.dossiers.filters.title')
- menu.with_form do - menu.with_form do
= render Dossiers::InstructeurFilterComponent.new(procedure:, procedure_presentation: @procedure_presentation, statut:) = render Instructeurs::ColumnFilterComponent.new(procedure:, procedure_presentation: @procedure_presentation, statut:)

View file

@ -109,7 +109,7 @@
- menu.with_button_inner_html do - menu.with_button_inner_html do
= t('views.instructeurs.dossiers.personalize') = t('views.instructeurs.dossiers.personalize')
- menu.with_form do - menu.with_form do
= render Dossiers::InstructeurFacetPickerComponent.new(procedure: @procedure, procedure_presentation: @procedure_presentation) = render Instructeurs::ColumnPickerComponent.new(procedure: @procedure, procedure_presentation: @procedure_presentation)
%tbody %tbody
= render Dossiers::BatchSelectMoreComponent.new(dossiers_count: @dossiers_count, filtered_sorted_ids: @filtered_sorted_ids) = render Dossiers::BatchSelectMoreComponent.new(dossiers_count: @dossiers_count, filtered_sorted_ids: @filtered_sorted_ids)

View file

@ -1,2 +1,2 @@
= turbo_stream.replace 'filter-component' do = turbo_stream.replace 'filter-component' do
= render Dossiers::InstructeurFilterComponent.new(procedure: @procedure, procedure_presentation: @procedure_presentation, statut: @statut, facet: @facet) = render Instructeurs::ColumnFilterComponent.new(procedure: @procedure, procedure_presentation: @procedure_presentation, statut: @statut, facet: @facet)

View file

@ -1,4 +1,4 @@
describe Dossiers::InstructeurFilterComponent, type: :component do describe Instructeurs::ColumnFilterComponent, type: :component do
let(:component) { described_class.new(procedure:, procedure_presentation:, statut:, facet:) } let(:component) { described_class.new(procedure:, procedure_presentation:, statut:, facet:) }
let(:instructeur) { create(:instructeur) } let(:instructeur) { create(:instructeur) }

View file

@ -0,0 +1,24 @@
describe Instructeurs::ColumnPickerComponent, type: :component do
let(:component) { described_class.new(procedure:, procedure_presentation:) }
let(:procedure) { create(:procedure) }
let(:instructeur) { create(:instructeur) }
let(:assign_to) { create(:assign_to, procedure: procedure, instructeur: instructeur) }
let(:procedure_presentation) { create(:procedure_presentation, assign_to: assign_to) }
describe "#displayable_fields_for_select" do
let(:default_user_email) { Facet.new(label: 'email', table: 'user', column: 'email') }
let(:excluded_displayable_field) { Facet.new(label: "label1", table: "table1", column: "column1", virtual: true) }
subject { component.displayable_fields_for_select }
before do
allow(Facet).to receive(:facets).and_return([
default_user_email,
excluded_displayable_field
])
end
it { is_expected.to eq([[["email", "user/email"]], ["user/email"]]) }
end
end