Skip to content

Commit c841b33

Browse files
committed
send patch request & add the simplest handler
1 parent cf0a7d8 commit c841b33

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/main/java/ru/mystamps/web/feature/series/HtmxSeriesController.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,30 @@ public String addCatalogNumbers(
132132

133133
return null;
134134
}
135+
136+
@PatchMapping(
137+
path = SeriesUrl.INFO_SERIES_PAGE,
138+
headers = "HX-Trigger=add-catalog-price-form"
139+
)
140+
public String addCatalogPrice(
141+
@PathVariable("id") Integer seriesId,
142+
HttpServletResponse response
143+
) throws IOException {
144+
145+
if (seriesId == null) {
146+
response.sendError(HttpServletResponse.SC_NOT_FOUND);
147+
return null;
148+
}
149+
150+
if (!seriesService.isSeriesExist(seriesId)) {
151+
response.sendError(HttpServletResponse.SC_NOT_FOUND);
152+
return null;
153+
}
154+
155+
// XXX: implement
156+
System.out.println("PATCH add catalog price");
157+
158+
return null;
159+
}
135160

136161
}

src/main/webapp/WEB-INF/views/series/info.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@ <h5 th:text="#{t_hidden_images}">Hidden images</h5>
411411

412412
<div id="add-catalog-price" sec:authorize="hasAuthority('CREATE_SERIES')">
413413
<div class="col-sm-12 form-group">
414-
<form id="add-catalog-price-form" class="form-horizontal">
414+
<form id="add-catalog-price-form"
415+
class="form-horizontal"
416+
th:hx-patch="@{${INFO_SERIES_PAGE}(id=${seriesId})}">
415417
<div class="form-group form-group-sm">
416418
<label for="price-catalog-name" class="control-label col-sm-3" th:text="#{t_catalog}">
417419
Catalog

0 commit comments

Comments
 (0)