Skip to content

Commit

Permalink
Use hx-push-url one more time
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyer committed Oct 21, 2023
1 parent 222f33f commit e874516
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public String htmxInitFindForm() {
}

@GetMapping("/owners")
public String ownersList(@RequestParam(defaultValue = "1") int page, Owner owner, BindingResult result, Model model) {
public String ownersList(@RequestParam(defaultValue = "1") int page, Owner owner, BindingResult result,
Model model) {
return processFindForm(page, owner, result, model, "owners/findOwners", "owners/ownersList");
}

Expand All @@ -128,7 +129,7 @@ public HtmxResponse htmxOwnersList(@RequestParam(defaultValue = "1") int page, O
Model model) {
String view = processFindForm(page, owner, result, model, FRAGMENTS_OWNERS_FIND_FORM,
"fragments/owners :: list");
return new HtmxResponse().addTemplate(view).pushHistory("/owners/find?lastName=" + owner.getLastName());
return new HtmxResponse().addTemplate(view);
}

public String processFindForm(@RequestParam(defaultValue = "1") int page, Owner owner, BindingResult result,
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/fragments/owners.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div th:fragment="find-form" th:remove="tag">
<h2>Find Owners</h2>

<form th:object="${owner}" th:action="@{/owners}" method="get"
<form th:object="${owner}" th:action="@{/owners}" method="get" hx-push-url="true"
hx:get="@{/owners}" hx-swap="innerHTML" hx-target="#block-content"
class="form-horizontal" id="search-owner-form">
<div class="form-group">
Expand Down

0 comments on commit e874516

Please sign in to comment.