11<!DOCTYPE html>
22< html xmlns:th ="http://www.thymeleaf.org " lang ="en ">
33< head >
4- < title > Import / Export Example </ title >
4+ < title > Cloner example </ title >
55 < style >
66 body { font-family : sans-serif; margin : 0 ; }
7- header {
8- padding : 10px ;
9- background : # f5f5f5 ;
10- display : flex;
11- gap : 10px ;
12- border-bottom : 1px solid # ddd ;
13- }
14- main { padding : 20px ; }
15- ul { padding-left : 20px ; }
7+ main { padding : 5px ; }
168 </ style >
179</ head >
1810< body >
1911
20- < header >
21- < form th:action ="@{/import} " method ="post " enctype ="multipart/form-data ">
22- < input type ="file " name ="file " required />
23- < button type ="submit "> Import</ button >
24- </ form >
12+ < main >
13+ < h1 > Cloner example</ h1 >
14+ < div style ="display: flex; gap: 10px; align-items: center; ">
15+ < p > Modify loaded data: </ p >
16+ < form th:action ="@{/insert-random} " method ="post ">
17+ < button type ="submit "> Insert Random Data</ button >
18+ </ form >
2519
26- < form th:action ="@{/insert-random } " method ="post ">
27- < button type ="submit "> Insert Random </ button >
28- </ form >
29- </ header >
20+ < form th:action ="@{/clear } " method ="post ">
21+ < button type ="submit "> Clear all </ button >
22+ </ form >
23+ </ div >
3024
31- < main >
32- < h2 > Elements</ h2 >
25+ < h3 > Elements</ h3 >
3326
3427 < form th:action ="@{/export} " method ="post ">
3528
@@ -47,9 +40,10 @@ <h2>Elements</h2>
4740 </ thead >
4841
4942 < tbody >
50- < tr th:each ="el : ${elements} ">
43+ < tr th:each ="el, elStat : ${elements} ">
5144 < td >
52- < input type ="checkbox " name ="selectedIds " th:value ="${el.id} " />
45+ < input type ="checkbox " name ="selectedIds " th:value ="${el.id} " th:if ="${elStat.index == 0} " required />
46+ < input type ="checkbox " name ="selectedIds " th:value ="${el.id} " th:unless ="${elStat.index == 0} " />
5347 </ td >
5448 < td th:text ="${el.name} "> </ td >
5549 < td >
@@ -59,7 +53,7 @@ <h2>Elements</h2>
5953 < td th:text ="${#temporals.format(el.date, 'yyyy-MM-dd')} "> </ td >
6054 < td th:text ="${#temporals.format(el.dateTime, 'yyyy-MM-dd HH:mm:ss')} "> </ td >
6155 < td >
62- < span th:each ="sub,iterStat : ${el.elements} ">
56+ < span th:each ="sub, iterStat : ${el.elements} ">
6357 < span th:text ="${sub.sample} "> </ span >
6458 (< input type ="checkbox " disabled ="disabled " th:checked ="${sub.tested} " /> )
6559 < span th:if ="${!iterStat.last} "> , </ span >
@@ -76,8 +70,16 @@ <h2>Elements</h2>
7670
7771 < br />
7872
79- < form th:action ="@{/clear} " method ="post ">
80- < button type ="submit "> Clear all</ button >
73+ < hr />
74+
75+ < br />
76+
77+ < form th:action ="@{/import} " method ="post " enctype ="multipart/form-data ">
78+ < label for ="file "> After exporting from a different environment, the entities can be imported here:</ label >
79+ < br />
80+ < br />
81+ < input id ="file " type ="file " name ="file " required />
82+ < button type ="submit "> Import</ button >
8183 </ form >
8284</ main >
8385
0 commit comments