remove manipulating checkbox with JS and set just one form instead of 2
This commit is contained in:
parent
59468fe351
commit
1ecdf5f544
3 changed files with 7 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
- if available_operations[:options].present?
|
||||
- if available_operations[:options].count == 1
|
||||
- opt = available_operations[:options].dig(0)
|
||||
= form_for(BatchOperation.new, url: instructeur_batch_operations_path(procedure_id: procedure.id), method: :post, html: { class: 'flex justify-end', id: "#{dom_id(BatchOperation.new)}_#{opt[:operation]}" }, data: { "batch-operation-target" => "form"}) do |form|
|
||||
= form_for(BatchOperation.new, url: instructeur_batch_operations_path(procedure_id: procedure.id), method: :post, html: { class: 'flex justify-end', id: "#{dom_id(BatchOperation.new)}" }, data: { "batch-operation-target" => "form"}) do |form|
|
||||
= form.button opt[:label], class: ['fr-btn fr-btn--icon-left', icons[opt[:operation].to_sym]], disabled: :disabled, name: "#{form.object_name}[operation]", data: { "batch-operation-target" => "submit", "submitter-operation" => opt[:operation] }
|
||||
|
||||
-else
|
||||
|
@ -12,11 +12,10 @@
|
|||
Actions multiples
|
||||
|
||||
#state-menu.dropdown-content.fade-in-down{ data: { menu_button_target: 'menu' } }
|
||||
|
||||
%ul.dropdown-items
|
||||
- available_operations[:options].each do |opt|
|
||||
%li{ 'data-turbo': 'true' }
|
||||
= form_for(BatchOperation.new, url: instructeur_batch_operations_path(procedure_id: procedure.id), method: :post, html: { class: 'flex justify-end form', id: "#{dom_id(BatchOperation.new)}_#{opt[:operation]}" }, data: { "batch-operation-target" => "form"}) do |form|
|
||||
= form_for(BatchOperation.new, url: instructeur_batch_operations_path(procedure_id: procedure.id), method: :post, html: { class: 'flex justify-end form', id: "#{dom_id(BatchOperation.new)}" }, data: { "batch-operation-target" => "form"}) do |form|
|
||||
%ul.dropdown-items
|
||||
- available_operations[:options].each do |opt|
|
||||
%li{ 'data-turbo': 'true' }
|
||||
- if opt[:operation] == 'accepter'
|
||||
.wrapper
|
||||
%a{ href: '#', onclick: "DS.showMotivation(event, 'accept');", class: ['fr-btn--icon-left', icons[opt[:operation].to_sym]] }
|
||||
|
|
|
@ -20,11 +20,6 @@ export class BatchOperationController extends ApplicationController {
|
|||
const submitter = event.submitter as HTMLInputElement;
|
||||
|
||||
submitter.setAttribute('value', submitter.dataset.submitterOperation || '');
|
||||
this.inputTargets.forEach((e) =>
|
||||
e.setAttribute(
|
||||
'form',
|
||||
`new_batch_operation_${submitter.dataset.submitterOperation}`
|
||||
));
|
||||
return event;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
- if @dossiers_count > 0
|
||||
%span.dossiers-export
|
||||
= render Dossiers::ExportComponent.new(procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count, export_url: method(:download_export_instructeur_procedure_path))
|
||||
%hr.fr-mt-5v
|
||||
|
||||
- if @filtered_sorted_paginated_ids.present? || @current_filters.count > 0
|
||||
- batch_operation_component = Dossiers::BatchOperationComponent.new(statut: @statut, procedure: @procedure)
|
||||
|
@ -124,7 +125,7 @@
|
|||
- 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')}
|
||||
- else
|
||||
= check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, false, data: { "batch-operation-target" => "input", "action" => "batch-operation#onCheckOne"}, 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"}, form: dom_id(BatchOperation.new), id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: {label: t('views.instructeurs.dossiers.batch_operation.enabled')}
|
||||
|
||||
- if @not_archived_notifications_dossier_ids.include?(p.dossier_id)
|
||||
%span.notifications{ 'aria-label': 'notifications' }
|
||||
|
|
Loading…
Reference in a new issue