add icon on submit button and simplify i18n
This commit is contained in:
parent
ea8bd13bcf
commit
3d2f0ebb88
9 changed files with 11 additions and 21 deletions
|
@ -13,8 +13,5 @@ en:
|
|||
text_success:
|
||||
one: 1 file has been archived
|
||||
other: "%{count} files have been archived"
|
||||
text_fail:
|
||||
one: 1 file has not been archived
|
||||
other: "%{count} have not been archived"
|
||||
link_text: Refresh this webpage
|
||||
after_link_text: to check if the process is over.
|
||||
|
|
|
@ -13,8 +13,5 @@ fr:
|
|||
text_success:
|
||||
one: 1 dossier a été archivé
|
||||
other: "%{count} dossiers ont été archivés"
|
||||
text_fail:
|
||||
one: 1 dossier n'a pas été archivé
|
||||
other: "%{count} dossiers n'ont pas été archivés"
|
||||
link_text: Recharger la page
|
||||
after_link_text: pour voir si l'opération est finie.
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
= render Dsfr::AlertComponent.new(title: t('.in_progress.title'), state: :info, heading_level: 'h2') do |c|
|
||||
- c.body do
|
||||
|
||||
- if @batch.failed_dossier_ids.present?
|
||||
%p
|
||||
= t('.in_progress.text_fail', count: @batch.failed_dossier_ids.count)
|
||||
|
||||
- if @batch.success_dossier_ids.present?
|
||||
%p
|
||||
= t('.in_progress.text_success', count: @batch.success_dossier_ids.count)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
fr:
|
||||
operations:
|
||||
archiver: 'Archive the selection'
|
||||
archiver: 'Archive selected files'
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
fr:
|
||||
operations:
|
||||
archiver: 'Archiver la sélection'
|
||||
archiver: 'Archiver les dossiers sélectionnés'
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
= form_for(BatchOperation.new, url: instructeur_batch_operations_path(procedure_id: procedure.id), method: :post, id: dom_id(BatchOperation.new), html: { class: 'flex justify-end' }, data: { "batch-operation-target" => "form"}) do |form|
|
||||
.flex.align-center
|
||||
- available_operations.each do |opt|
|
||||
= form.submit opt[0], class: "fr-btn", disabled: :disabled, name: "#{form.object_name}[operation]", data: { "batch-operation-target" => "submit", "submitter-operation" => opt[1]}
|
||||
|
||||
= form.button opt[0], class: "fr-btn fr-btn--icon-left fr-icon-folder-2-line", disabled: :disabled, name: "#{form.object_name}[operation]", data: { "batch-operation-target" => "submit", "submitter-operation" => opt[1]}
|
||||
|
|
|
@ -24,6 +24,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
|||
batch_operation.track_processed_dossier(true, dossier)
|
||||
batch_operation.reload
|
||||
}
|
||||
|
||||
it { is_expected.to have_selector('.fr-alert--info') }
|
||||
it { is_expected.to have_text("Une action de masse est en cours") }
|
||||
it { is_expected.to have_text("1 dossier a été archivé") }
|
||||
|
@ -63,7 +64,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
|||
it 'does not display alert on the next render' do
|
||||
render_inline(component).to_html
|
||||
expect(batch_operation.seen_at).not_to eq(nil)
|
||||
expect(subject).not_to have_text("2 dossiers ont été archivés")
|
||||
expect(subject).not_to have_text("1 dossier n'a pas été archivé")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,11 +14,11 @@ 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_selector('input') }
|
||||
it { is_expected.to have_selector('button') }
|
||||
end
|
||||
|
||||
context 'statut tous' do
|
||||
let(:statut) { 'tous' }
|
||||
it { is_expected.not_to have_selector('input') }
|
||||
it { is_expected.not_to have_selector('button') }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,15 +17,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_selector('input[disabled][value="Archiver la sélection"]')
|
||||
expect(page).to have_button("Archiver les dossiers sélectionnés", disabled: true)
|
||||
|
||||
checkbox_id = dom_id(BatchOperation.new, "checkbox_#{dossier_1.id}")
|
||||
# batch one dossier
|
||||
check(checkbox_id)
|
||||
expect(page).to have_selector('input[value="Archiver la sélection"]')
|
||||
expect(page).to have_button("Archiver les dossiers sélectionnés")
|
||||
|
||||
# ensure batch is created
|
||||
expect { click_on "Archiver la sélection" }
|
||||
expect { click_on "Archiver les dossiers sélectionnés" }
|
||||
.to change { BatchOperation.count }
|
||||
.from(0).to(1)
|
||||
|
||||
|
@ -61,7 +61,7 @@ describe 'BatchOperation a dossier:', js: true do
|
|||
end
|
||||
|
||||
# submnit checkall
|
||||
expect { click_on "Archiver la sélection" }
|
||||
expect { click_on "Archiver les dossiers sélectionnés" }
|
||||
.to change { BatchOperation.count }
|
||||
.from(1).to(2)
|
||||
|
||||
|
|
Loading…
Reference in a new issue