Skip to content

Commit bec837e

Browse files
committed
Deprecate /country/list and add redirect to /countries.
Addressed to #583 No functional changes.
1 parent 25b2b7c commit bec837e

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

src/main/java/ru/mystamps/web/Url.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public final class Url {
6464
public static final String INFO_CATEGORY_PAGE = "/category/{slug}";
6565

6666
public static final String ADD_COUNTRY_PAGE = "/country/add";
67-
public static final String LIST_COUNTRIES_PAGE = "/country/list";
67+
public static final String GET_COUNTRIES_PAGE = "/countries";
6868
public static final String INFO_COUNTRY_PAGE = "/country/{slug}";
6969

7070
public static final String INFO_COLLECTION_PAGE = "/collection/{slug}";
@@ -81,6 +81,7 @@ public final class Url {
8181
// For backward compatibility
8282
public static final String ACTIVATE_ACCOUNT_PAGE_WITH_KEY = "/account/activate/key/{key}";
8383
public static final String LIST_CATEGORIES_PAGE = "/category/list";
84+
public static final String LIST_COUNTRIES_PAGE = "/country/list";
8485
public static final String INFO_CATEGORY_BY_ID_PAGE = "/category/{id}/{slug}";
8586
public static final String INFO_COUNTRY_BY_ID_PAGE = "/country/{id}/{slug}";
8687
public static final String INFO_COLLECTION_BY_ID_PAGE = "/collection/{id}/{slug}";
@@ -146,7 +147,7 @@ public static Map<String, String> asMap(boolean production) {
146147
map.put("INFO_COUNTRY_PAGE", INFO_COUNTRY_PAGE);
147148
map.put("INFO_SERIES_PAGE", INFO_SERIES_PAGE);
148149
map.put("GET_CATEGORIES_PAGE", GET_CATEGORIES_PAGE);
149-
map.put("LIST_COUNTRIES_PAGE", LIST_COUNTRIES_PAGE);
150+
map.put("GET_COUNTRIES_PAGE", GET_COUNTRIES_PAGE);
150151
map.put("LIST_IMPORT_REQUESTS_PAGE", LIST_IMPORT_REQUESTS_PAGE);
151152
map.put("LOGIN_PAGE", LOGIN_PAGE);
152153
map.put("LOGOUT_PAGE", LOGOUT_PAGE);

src/main/java/ru/mystamps/web/controller/CountryController.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,22 @@ public View showInfoById(
138138
return view;
139139
}
140140

141-
@GetMapping(Url.LIST_COUNTRIES_PAGE)
142-
public void list(Model model, Locale userLocale) {
141+
@GetMapping(Url.GET_COUNTRIES_PAGE)
142+
public String showCountries(Model model, Locale userLocale) {
143143
String lang = LocaleUtils.getLanguageOrNull(userLocale);
144144
List<LinkEntityDto> countries = countryService.findAllAsLinkEntities(lang);
145145

146146
model.addAttribute("countries", countries);
147+
148+
return "country/list";
149+
}
150+
151+
@GetMapping(Url.LIST_COUNTRIES_PAGE)
152+
public View list() {
153+
RedirectView view = new RedirectView();
154+
view.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
155+
view.setUrl(Url.GET_COUNTRIES_PAGE);
156+
return view;
147157
}
148158

149159
}

src/main/webapp/WEB-INF/views/site/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<a th:href="@{${GET_CATEGORIES_PAGE}}" th:text="#{t_show_categories_list}" href="../category/list.html">show list of categories</a>
6969
</li>
7070
<li togglz:active="LIST_COUNTRIES">
71-
<a th:href="@{${LIST_COUNTRIES_PAGE}}" th:text="#{t_show_countries_list}" href="../country/list.html">show list of countries</a>
71+
<a th:href="@{${GET_COUNTRIES_PAGE}}" th:text="#{t_show_countries_list}" href="../country/list.html">show list of countries</a>
7272
</li>
7373
<li sec:authorize="hasAuthority('IMPORT_SERIES')">
7474
<a th:href="@{${LIST_IMPORT_REQUESTS_PAGE}}" th:text="#{t_show_import_requests_list}" href="../series/import/list.html">show list of import requests</a>

0 commit comments

Comments
 (0)