Skip to content

Commit d618de2

Browse files
committed
improve: on the collection page show a hint when a series has multiple images
Fix #1420
1 parent e47225d commit d618de2

File tree

8 files changed

+23
-2
lines changed

8 files changed

+23
-2
lines changed

src/main/java/ru/mystamps/web/feature/collection/RowMappers.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ private RowMappers() {
5050
Boolean perforated = rs.getBoolean("perforated");
5151
Integer previewId = JdbcUtils.getInteger(rs, "preview_id");
5252
Integer numberOfStamps = rs.getInt("number_of_stamps");
53+
Integer numberOfImages = rs.getInt("number_of_images");
5354

5455
return new SeriesInCollectionDto(
5556
seriesId,
@@ -59,7 +60,8 @@ private RowMappers() {
5960
perforated,
6061
quantity,
6162
previewId,
62-
numberOfStamps
63+
numberOfStamps,
64+
numberOfImages
6365
);
6466
}
6567

src/main/java/ru/mystamps/web/feature/collection/SeriesInCollectionDto.java

+1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ public class SeriesInCollectionDto {
3333
// quantity holds number of stamps in a series, while user may
3434
// have less stamps in his collection
3535
private final Integer numberOfStamps;
36+
private final Integer numberOfImages;
3637
}

src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public final class ResourceUrl {
3232
public static final String STATIC_RESOURCES_URL = "https://stamps.filezz.ru";
3333

3434
// MUST be updated when any of our resources were modified
35-
public static final String RESOURCES_VERSION = "v0.4.4.1";
35+
public static final String RESOURCES_VERSION = "v0.4.4.2";
3636

3737
// CheckStyle: ignore LineLength for next 16 lines
3838
private static final String CATALOG_UTILS_JS = "/public/js/" + RESOURCES_VERSION + "/CatalogUtils.min.js";

src/main/resources/ru/mystamps/i18n/Messages.properties

+1
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ t_stamps_by_countries = Stamps by countries
198198
t_unspecified = Unspecified
199199
t_cost = The cost
200200
t_how_much = how much?
201+
t_images_counter = {0} images
201202

202203
# collection/estimation.html
203204
t_series = Series

src/main/resources/ru/mystamps/i18n/Messages_ru.properties

+1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ t_stamps_by_countries = Марки по странам
197197
t_unspecified = Не указана
198198
t_cost = Стоимость
199199
t_how_much = сколько?
200+
t_images_counter = изображений: {0}
200201

201202
# collection/estimation.html
202203
t_series = Серия

src/main/resources/sql/collection_dao_queries.properties

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ collection.find_series_by_collection_id = \
1818
, s.quantity \
1919
, s.perforated \
2020
, cs.number_of_stamps \
21+
, ( \
22+
SELECT COUNT(*) \
23+
FROM series_images si \
24+
WHERE si.series_id = s.id \
25+
AND si.hidden = FALSE\
26+
) AS number_of_images \
2127
, ( \
2228
SELECT si.image_id \
2329
FROM series_images si \

src/main/webapp/WEB-INF/static/styles/main.css

+6
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,14 @@ label {
119119
.image-gallery figure {
120120
/* margin: <top> <right> <bottom> <left> */
121121
margin: 15px 0 15px 15px;
122+
position: relative;
122123
}
123124
.image-gallery figcaption {
124125
margin-top: 5px;
125126
text-align: center;
126127
}
128+
.image-gallery .image-counter {
129+
position: absolute;
130+
top: 10px;
131+
left: 10px;
132+
}

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

+4
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ <h4 class="panel-title" th:text="#{t_stamps_by_categories}">Stamps by categories
143143
th:alt="${desc}"
144144
th:title="${desc}"
145145
th:src="@{${GET_IMAGE_PREVIEW_PAGE}(id=${series.previewId})}" />
146+
<span class="label label-default image-counter"
147+
th:if="${series.numberOfImages &gt; 1}"
148+
th:text="#{t_images_counter(${series.numberOfImages})}">5 images</span>
146149
</a>
147150
<figcaption>
148151
<a href="../series/info.html" th:href="@{${INFO_SERIES_PAGE}(id=${series.id})}" th:text="${desc}">
@@ -173,6 +176,7 @@ <h4 class="panel-title" th:text="#{t_stamps_by_categories}">Stamps by categories
173176
<figure>
174177
<a href="../series/info.html">
175178
<img src="http://via.placeholder.com/250" alt="Prehistoric animals, Italy, 22&nbsp;stamps" title="Prehistoric animals, Italy, 22&nbsp;stamps" />
179+
<span class="label label-default image-counter">2 images</span>
176180
</a>
177181
<figcaption>
178182
<a href="../series/info.html">Prehistoric animals, Italy, 22&nbsp;stamps</a>

0 commit comments

Comments
 (0)