@@ -338,16 +338,24 @@ class App {
338
338
. replace ( '%action_name%' , actionName )
339
339
. replace ( '%num_items%' , selectedItems . length . toString ( ) ) ;
340
340
341
+ if ( actionElement . getAttribute ( 'data-display-batch-modal-confirmation' ) === 'false' ) {
342
+ batchFormSubmit ( actionElement , selectedItems ) ;
343
+ }
344
+
341
345
document . querySelector ( '#modal-batch-action-button' ) . addEventListener ( 'click' , ( ) => {
342
346
// prevent double submission of the batch action form
343
347
actionElement . setAttribute ( 'disabled' , 'disabled' ) ;
348
+ batchFormSubmit ( actionElement , selectedItems ) ;
349
+ } ) ;
344
350
351
+ function batchFormSubmit ( actionElement , selectedItems ) {
345
352
const batchFormFields = {
346
353
'batchActionName' : actionElement . getAttribute ( 'data-action-name' ) ,
347
354
'entityFqcn' : actionElement . getAttribute ( 'data-entity-fqcn' ) ,
348
355
'batchActionUrl' : actionElement . getAttribute ( 'data-action-url' ) ,
349
356
'batchActionCsrfToken' : actionElement . getAttribute ( 'data-action-csrf-token' ) ,
350
357
} ;
358
+
351
359
selectedItems . forEach ( ( item , i ) => {
352
360
batchFormFields [ `batchActionEntityIds[${ i } ]` ] = item . value ;
353
361
} ) ;
@@ -365,7 +373,7 @@ class App {
365
373
366
374
document . body . appendChild ( batchForm ) ;
367
375
batchForm . submit ( ) ;
368
- } ) ;
376
+ }
369
377
} ) ;
370
378
} ) ;
371
379
}
0 commit comments