Added list and show pages

This commit is contained in:
Daniel Fernández
2012-12-26 00:14:17 +01:00
committed by Rossen Stoyanchev
parent 60581276a7
commit 196ec3ce14
2 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
<h1>Hotel Results</h1>
<p>
<a id="changeSearchLink" href="#"
th:href="@{hotels/search(searchString=${searchCriteria.searchString},pageSize=${searchCriteria.pageSize})}">Change Search</a>
<script type="text/javascript">
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId: "changeSearchLink",
event: "onclick",
popup: true,
params: {fragments: "searchForm"}
}));
</script>
</p>
<div id="hotelResults">
<div th:if="${hotelList}">
<table class="summary">
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<th>City, State</th>
<th>Zip</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr th:each="hotel : ${hotelList}">
<td th:text="${hotel.name}">The Herb Plaza</td>
<td th:text="${hotel.address}">Thyme Square, 13</td>
<td th:text="${hotel.city} + ', ' + ${hotel.state} + ', ' + ${hotel.country}">Icetown, North Pole, Earth</td>
<td th:text="${hotel.zip}">0W</td>
<td><a href="#" th:href="@{'hotels/' + ${hotel.id}}">View Hotel</a></td>
</tr>
<tr th:unless="${hotelList}">
<td colspan="5">No hotels found</td>
</tr>
</tbody>
</table>
<div class="buttonGroup">
<div class="span-3">
<div th:if="${searchCriteria.page > 0}">
<a id="prevResultsLink" href="#"
th:href="@{hotels(searchString=${searchCriteria.searchString},pageSize=${searchCriteria.pageSize},page=${searchCriteria.page - 1})}">Previous Results</a>
<script type="text/javascript">
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId: "prevResultsLink",
event: "onclick",
params: {fragments: "body"}
}));
</script>
</div>
</div>
<div class="span-3 append-12 last">
<div th:if="${hotelList} and ${hotelList.size() == searchCriteria.pageSize}">
<a id="moreResultsLink" href="#"
th:href="@{hotels(searchString=${searchCriteria.searchString},pageSize=${searchCriteria.pageSize},page=${searchCriteria.page + 1})}">More Results</a>
<script type="text/javascript">
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId: "moreResultsLink",
event: "onclick",
params: {fragments: "body"}
}));
</script>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,19 @@
<h1 th:text="${hotel.name}">The Herb Plaza</h1>
<address>
<span th:text="${hotel.address}">Thyme Square, 13</span>
<br />
<span th:text="${hotel.city}">Icetown</span>,
<span th:text="${hotel.state}">North Pole</span>,
<span th:text="${hotel.zip}">0W</span>
<br />
<span th:text="${hotel.country}">Earth</span>
</address>
<form action="booking?mode=embedded" method="get">
<p>
Nightly Rate: <span th:text="${hotel.price}">4,300</span>
</p>
<input type="hidden" name="hotelId" th:value="${hotel.id}" />
<div>
<button type="submit">Book Hotel</button>
</div>
</form>