row.html 1.74 KB
Newer Older
1
2
3
4
5
6
<!DOCTYPE html>

<html xmlns:th="http://www.thymeleaf.org">

<body>

Jean-Baptiste Nizet's avatar
Jean-Baptiste Nizet committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!--
Reusable fragment displaying a responsive row containing a label and a content.
The label argument is a string.
The content argument is a fragment which is displayed at the right of the label.

Note that `th:if` is not evaluated when th:replace is used. So if this row must
be displayed only if some condition is true, the fragment should be enclosed
into a block with the condition:
  <th:block th:if="${someCondition}">
    <div th:replace="fragments/row::row(label='Some label', content=~{::#some-content-id})">
      <span id="some-content-id">the content here</span>
    </div>
  </th:block>
-->

22
23
24
25
26
27
28
<div th:fragment="row(label, content)" class="row py-2">
  <div class="col-md-4 label pb-1 pb-md-0" th:text="${label}"></div>
  <div class="col">
    <th:block th:replace="${content}" />
  </div>
</div>

Jean-Baptiste Nizet's avatar
Jean-Baptiste Nizet committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!--
Reusable fragment displaying a responsive row containing a label and a textual content.
The label argument is a string.
The text argument is a string which is displayed at the right of the label.
The whole row is omitted if the textual content is empty, so the caller does not
need to test that condition.

Note that `th:if` is not evaluated when th:replace is used. So if this row must
be displayed only if some other condition is true, the fragment should be enclosed
into a block with the condition:
  <th:block th:if="${someCondition}">
    <div th:replace="fragments/row::text-row(label='Some label', text=${someTextExpression})"></div>
  </th:block>
-->
<div th:fragment="text-row(label, text)" th:unless="${#strings.isEmpty(text)}" class="row py-2">
44
45
46
47
48
49
50
  <div class="col-md-4 label pb-1 pb-md-0" th:text="${label}"></div>
  <div class="col" th:text="${text}"></div>
</div>

</body>

</html>