@@ -78,7 +78,7 @@ function bytesToHuman($bytes) {
7878</div >
7979<br >
8080<div data-role =" panel" data-title-caption =" {{ trans (' cruds.document.title.cleanup' ) } }" data-collapsible =" false" data-title-icon =" <span class='mif-file-text'></span>" >
81- <form action =" /doc/config" method =" POST" >
81+ <form id = " cleanupForm " action =" /doc/config" method =" POST" >
8282 @csrf
8383 <div class =" grid" >
8484 <div class =" row" >
@@ -88,7 +88,7 @@ function bytesToHuman($bytes) {
8888 </div >
8989 <div class =" row" >
9090 <div class =" cell-2" >
91- <select name =" duration" data-role =" select" data-prepend =" {{ trans (' cruds.document.month' ) } }" >
91+ <select id = " durationSelect " name =" duration" data-role =" select" data-prepend =" {{ trans (' cruds.document.month' ) } }" >
9292 <option value =" 0" {{ ($duration == " 0" || $duration == null ) ? ' selected' : ' ' } } >{{ trans (' cruds.document.never' ) } } </option >
9393 <option {{ $duration == " 12" ? ' selected' : ' ' } } >12</option >
9494 <option {{ $duration == " 24" ? ' selected' : ' ' } } >24</option >
@@ -113,7 +113,7 @@ function bytesToHuman($bytes) {
113113 {{ trans (" common.test" ) } }
114114 </button >
115115   ;
116- <button type =" submit" class =" button alert" name =" action" value =" delete" >
116+ <button type =" submit" class =" button alert" name =" action" value =" delete" id = " deleteButton " >
117117 <span class =" mif-bin" ></span >
118118   ;
119119 {{ trans (" common.delete" ) } }
@@ -124,4 +124,15 @@ function bytesToHuman($bytes) {
124124 </form >
125125</div >
126126
127+ <script >
128+ document .addEventListener (" DOMContentLoaded" , function () {
129+ document .getElementById (" deleteButton" ).addEventListener (" click" , function (event ) {
130+ const select = document .getElementById (" durationSelect" );
131+ const selected = select .options [select .selectedIndex ].value ;
132+ if ((selected== 0 )|| (! confirm (" {{ trans (' cruds.control.confirm_delete' ) } }" )))
133+ event .preventDefault ();
134+ });
135+ });
136+ </script >
137+
127138@endsection
0 commit comments