Merge pull request #8860 from demarches-simplifiees/ay11-actions-multiples
[a11y] actions multiples
This commit is contained in:
commit
7ea443f86a
7 changed files with 41 additions and 12 deletions
|
@ -1,15 +1,15 @@
|
|||
%tr#js_batch_select_more.fr-background-alt--blue-france.hidden
|
||||
%td.fr-py-2w.text-center{ colspan: 100 }
|
||||
#not_selected
|
||||
%p
|
||||
%p{ role: "status" }
|
||||
= t('.pagination_files_selected_html')
|
||||
%button.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline{ data: not_selected_button_data }
|
||||
%button#js_select_more.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline{ data: not_selected_button_data }
|
||||
= not_selected_text
|
||||
|
||||
#selected.hidden
|
||||
%p
|
||||
%p{ role: "status" }
|
||||
= selected_text
|
||||
%button.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline{ data: selected_button_data }
|
||||
%button#js_delete_selection.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline{ data: selected_button_data }
|
||||
= t(".delete_selection")
|
||||
|
||||
= hidden_field_tag :"batch_operation[dossier_ids][]", "", form: dom_id(BatchOperation.new), id: dom_id(BatchOperation.new, "input_multiple_ids")
|
||||
|
|
|
@ -24,6 +24,12 @@ export class BatchOperationController extends ApplicationController {
|
|||
if (pagination) {
|
||||
displayNotice(this.inputTargets);
|
||||
}
|
||||
|
||||
// add focus on button for a11y
|
||||
const button = document.getElementById('js_select_more');
|
||||
if (button) {
|
||||
button.focus();
|
||||
}
|
||||
}
|
||||
|
||||
onSelectMore(event: {
|
||||
|
@ -44,6 +50,12 @@ export class BatchOperationController extends ApplicationController {
|
|||
|
||||
hide(document.querySelector('#not_selected'));
|
||||
show(document.querySelector('#selected'));
|
||||
|
||||
// add focus on button for a11y
|
||||
const button = document.getElementById('js_delete_selection');
|
||||
if (button) {
|
||||
button.focus();
|
||||
}
|
||||
}
|
||||
|
||||
onDeleteSelection(event: { preventDefault: () => void }) {
|
||||
|
|
|
@ -340,6 +340,22 @@ class ProcedurePresentation < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def sortable?(field)
|
||||
sort['table'] == field['table'] && sort['column'] == field['column']
|
||||
end
|
||||
|
||||
def aria_sort(order, field)
|
||||
if sortable?(field)
|
||||
if order == 'asc'
|
||||
{ "aria-sort": "ascending" }
|
||||
elsif order == 'desc'
|
||||
{ "aria-sort": "descending" }
|
||||
end
|
||||
else
|
||||
{}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def field_id(field)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
%th{ class: classname }
|
||||
%th{ @procedure_presentation.aria_sort(@procedure_presentation.sort['order'], field), scope: "col", class: classname }
|
||||
|
||||
= link_to update_sort_instructeur_procedure_path(@procedure, table: field['table'], column: field['column'], order: @procedure_presentation.opposite_order_for(field['table'], field['column'])) do
|
||||
- if @procedure_presentation.sort['table'] == field['table'] && @procedure_presentation.sort['column'] == field['column']
|
||||
- if @procedure_presentation.sortable?(field)
|
||||
- if @procedure_presentation.sort['order'] == 'asc'
|
||||
#{field['label']} ↑
|
||||
- else
|
||||
|
|
|
@ -133,9 +133,9 @@
|
|||
%td.text-center
|
||||
- if batch_operation_component.render?
|
||||
- if p.batch_operation_id.present?
|
||||
= check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, true, disabled: true, id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: { label: t('views.instructeurs.dossiers.batch_operation.disabled') }
|
||||
= check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, true, disabled: true, id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: { label: t('views.instructeurs.dossiers.batch_operation.disabled', dossier_id: p.dossier_id) }
|
||||
- else
|
||||
= check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, false, data: { batch_operation_target: "input", action: "batch-operation#onCheckOne", operations: batch_operation_component.operations_for_dossier(p).join(',') }, form: dom_id(BatchOperation.new), id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: { label: t('views.instructeurs.dossiers.batch_operation.enabled') }
|
||||
= check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, false, data: { batch_operation_target: "input", action: "batch-operation#onCheckOne", operations: batch_operation_component.operations_for_dossier(p).join(',') }, form: dom_id(BatchOperation.new), id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: { label: t('views.instructeurs.dossiers.batch_operation.enabled', dossier_id: p.dossier_id) }
|
||||
|
||||
- if @not_archived_notifications_dossier_ids.include?(p.dossier_id)
|
||||
%span.notifications{ 'aria-label': 'notifications' }
|
||||
|
|
|
@ -371,8 +371,8 @@ en:
|
|||
title: Select a filter
|
||||
select_all: Select all
|
||||
batch_operation:
|
||||
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"
|
||||
enabled: "Add file %{dossier_id} to the selection for the bulk operation"
|
||||
disabled: "Impossible to add file %{dossier_id} to the selection because it is already in a bulk operation"
|
||||
personalize: Personalize the table
|
||||
show_deleted_dossiers: Show deleted files
|
||||
follow_file: Follow-up the file
|
||||
|
|
|
@ -371,8 +371,8 @@ fr:
|
|||
title: Sélectionner un filtre
|
||||
select_all: Tout selectionner
|
||||
batch_operation:
|
||||
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"
|
||||
enabled: "Ajouter le dossier %{dossier_id} à la selection pour un traitement de masse"
|
||||
disabled: "Impossible d'ajouter le dossier %{dossier_id} à la selection car il est déjà dans un traitement de masse"
|
||||
show_deleted_dossiers: Afficher les dossiers supprimés
|
||||
personalize: Personnaliser le tableau
|
||||
download: Télécharger un dossier
|
||||
|
|
Loading…
Reference in a new issue