Skip to content

Commit

Permalink
Replace th:attr with hx:get from the htmx-spring-boot-thymeleaf l…
Browse files Browse the repository at this point in the history
…ibrary.

Fixes #6
  • Loading branch information
wimdeblauwe committed Oct 18, 2023
1 parent f135a83 commit 6674893
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/main/resources/templates/fragments/owners.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h2>Owners</h2>
<tr th:each="owner : ${listOwners}">
<td>
<a th:href="@{/owners/__${owner.id}__}" th:text="${owner.firstName + ' ' + owner.lastName}"
th:attr="hx-get=@{/owners/__${owner.id}__}" hx-target="#block-content"/></a>
hx:get="@{/owners/__${owner.id}__}" hx-target="#block-content"/></a>
</td>
<td th:text="${owner.address}"/>
<td th:text="${owner.city}"/>
Expand Down Expand Up @@ -83,10 +83,10 @@ <h2>Owner Information</h2>
</tr>
</table>

<a th:attr="hx-get=@{__${owner.id}__/edit}" hx-target="#block-content" th:href="@{__${owner.id}__/edit}"
<a hx:get="@{__${owner.id}__/edit}" hx-target="#block-content" th:href="@{__${owner.id}__/edit}"
class="btn btn-primary">Edit
Owner</a>
<a th:attr="hx-get=@{__${owner.id}__/pets/new}" th:href="@{__${owner.id}__/pets/new}" hx-target="#block-content" class="btn btn-primary">Add
<a hx:get="@{__${owner.id}__/pets/new}" th:href="@{__${owner.id}__/pets/new}" hx-target="#block-content" class="btn btn-primary">Add
New Pet</a>
</div>

Expand Down Expand Up @@ -122,9 +122,9 @@ <h2>Pets and Visits</h2>
</tr>
<tr>
<td><a th:href="@{__${owner.id}__/pets/__${pet.id}__/edit}"
th:attr="hx-get=@{__${owner.id}__/pets/__${pet.id}__/edit}" hx-target="#block-content">Edit Pet</a></td>
hx-get="@{__${owner.id}__/pets/__${pet.id}__/edit}" hx-target="#block-content">Edit Pet</a></td>
<td><a th:href="@{__${owner.id}__/pets/__${pet.id}__/visits/new}"
th:attr="hx-get=@{__${owner.id}__/pets/__${pet.id}__/visits/new}" hx-target="#block-content">Add Visit</a></td>
hx:get="@{__${owner.id}__/pets/__${pet.id}__/visits/new}" hx-target="#block-content">Add Visit</a></td>
</tr>
</table>
</td>
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/templates/fragments/pagination.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<span th:fragment="item(url,page,condition)" th:tag="remove">
<a th:if="${condition}" th:attr="hx-get=@{${url} + '?page=' + ${page}}" th:href="@{'/owners?page=' + ${page}}" hx-target="#block-content">[[${page}]]</a>
<a th:if="${condition}" hx:get="@{${url}(page=${page})}" th:href="@{${url}(page=${page})}" hx-target="#block-content">[[${page}]]</a>
<span th:unless="${condition}">[[${page}]]</span>
</span>

<span th:fragment="control(url, page,condition,title,class)" th:tag="remove">
<a th:if="${condition}" th:attr="hx-get=@{${url} + '?page=' + ${page}}" th:href="@{'/owners?page=' + ${page}}" hx-target="#block-content" th:title="${title}" th:class="${class}"></a>
<a th:if="${condition}" hx:get="@{${url}(page=${page})}" th:href="@{${url}(page=${page})}" hx-target="#block-content" th:title="${title}" th:class="${class}"></a>
<span th:unless="${condition}" th:title="${title}" th:class="${class}"></span>
</span>

Expand Down

0 comments on commit 6674893

Please sign in to comment.