Skip to content

Commit f461dbb

Browse files
committed
/series/add: hide catalog numbers, issue date and comment fields by default.
1 parent 0ffad9f commit f461dbb

File tree

3 files changed

+51
-7
lines changed

3 files changed

+51
-7
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,18 @@ t_enter = Sign in
8181

8282
# series/add.html
8383
t_add_series_ucfirst = Add stamp series
84+
t_specify_issue_date = Specify date of release
8485
t_day = Day
8586
t_month = Month
8687
t_year = Year
8788
t_quantity = Quantity
8889
t_perforated = Perforated
90+
t_add_catalogs_info = Add information from stamps catalogues
8991
t_michel = Michel
9092
t_scott = Scott
9193
t_yvert = Yvert
9294
t_sg = Gibbons
95+
t_add_comment = Add comment
9396
t_comment = Comment
9497
t_image = Image
9598
t_add_more_images_hint = Later you will be able to add additional images

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,18 @@ t_enter = Войти
8181

8282
# series/add.html
8383
t_add_series_ucfirst = Добавить серию марок
84+
t_specify_issue_date = Указать дату выпуска
8485
t_day = День
8586
t_month = Месяц
8687
t_year = Год
8788
t_quantity = Количество
8889
t_perforated = Перфорированная
90+
t_add_catalogs_info = Добавить информацию из каталогов
8991
t_michel = Michel
9092
t_scott = Scott
9193
t_yvert = Yvert
9294
t_sg = Gibbons
95+
t_add_comment = Добавить комментарий
9396
t_comment = Комментарий
9497
t_image = Изображение
9598
t_add_more_images_hint = Вы сможете добавить дополнительные изображения позже

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

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ <h3 th:text="#{t_add_series_ucfirst}">
6363
</small>
6464
</div>
6565

66-
<form method="post" enctype="multipart/form-data" class="form-horizontal" action="info.html" th:action="@{${ADD_SERIES_PAGE}} + '?' + ${_csrf.parameterName} + '=' + ${_csrf.token}" th:object="${addSeriesForm}">
66+
<form method="post" enctype="multipart/form-data" class="form-horizontal" action="info.html"
67+
th:action="@{${ADD_SERIES_PAGE}} + '?' + ${_csrf.parameterName} + '=' + ${_csrf.token}"
68+
th:object="${addSeriesForm}"
69+
th:with="michelHasErrors=${#fields.hasErrors('michelNumbers') or #fields.hasErrors('michelPrice') or #fields.hasErrors('michelCurrency')},
70+
scottHasErrors=${#fields.hasErrors('scottNumbers') or #fields.hasErrors('scottPrice') or #fields.hasErrors('scottCurrency')},
71+
yvertHasErrors=${#fields.hasErrors('yvertNumbers') or #fields.hasErrors('yvertPrice') or #fields.hasErrors('yvertCurrency')},
72+
gibbonsHasErrors=${#fields.hasErrors('gibbonsNumbers') or #fields.hasErrors('gibbonsPrice') or #fields.hasErrors('gibbonsCurrency')},
73+
showCatalogsInfo=${michelHasErrors or scottHasErrors or yvertHasErrors or gibbonsHasErrors}">
6774

6875
<div class="form-group form-group-sm" th:classappend="${#fields.hasErrors('category') ? 'has-error' : ''}">
6976
<label for="category" class="control-label col-sm-3">
@@ -110,7 +117,15 @@ <h3 th:text="#{t_add_series_ucfirst}">
110117
</div>
111118
</div>
112119

113-
<div class="form-group form-group-sm" th:classappend="${#fields.hasErrors('day') or #fields.hasErrors('month') or #fields.hasErrors('year') ? 'has-error' : ''}">
120+
<div class="form-group js-collapse-toggle-header">
121+
<div class="col-sm-offset-3 col-sm-5">
122+
<span class="glyphicon glyphicon-chevron-right" th:class="${#fields.hasErrors('day') or #fields.hasErrors('month') or #fields.hasErrors('year') ? 'glyphicon glyphicon-chevron-down' : 'glyphicon glyphicon-chevron-right'}"></span>&nbsp;<a href="javascript:void(0)" data-toggle="collapse" data-target=".js-issue-date" th:text="#{t_specify_issue_date}">
123+
Specify date of release
124+
</a>
125+
</div>
126+
</div>
127+
128+
<div class="form-group form-group-sm collapse js-issue-date" th:classappend="${#fields.hasErrors('day') or #fields.hasErrors('month') or #fields.hasErrors('year') ? 'has-error in' : ''}">
114129
<label for="year" class="control-label col-sm-3">
115130
<span class="field-label" th:text="#{t_issue_date}">
116131
Date of release
@@ -227,7 +242,15 @@ <h3 th:text="#{t_add_series_ucfirst}">
227242
</div>
228243
</div>
229244

230-
<div class="form-group form-group-sm" th:classappend="${#fields.hasErrors('michelNumbers') or #fields.hasErrors('michelPrice') or #fields.hasErrors('michelCurrency') ? 'has-error' : ''}">
245+
<div class="form-group js-collapse-toggle-header">
246+
<div class="col-sm-offset-3 col-sm-7">
247+
<span class="glyphicon glyphicon-chevron-right" th:class="${showCatalogsInfo ? 'glyphicon glyphicon-chevron-down' : 'glyphicon glyphicon-chevron-right'}"></span>&nbsp;<a href="javascript:void(0)" data-toggle="collapse" data-target=".js-catalogs-info" th:text="#{t_add_catalogs_info}">
248+
Add information from stamps catalogues
249+
</a>
250+
</div>
251+
</div>
252+
253+
<div class="form-group form-group-sm collapse js-catalogs-info" th:classappend="|${michelHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'in' : ''}|">
231254
<label for="michelNumbers" class="control-label col-sm-3">
232255
<span class="field-label" th:text="#{t_michel}">
233256
Michel
@@ -260,7 +283,7 @@ <h3 th:text="#{t_add_series_ucfirst}">
260283
</div>
261284
</div>
262285

263-
<div class="form-group form-group-sm" th:classappend="${#fields.hasErrors('scottNumbers') or #fields.hasErrors('scottPrice') or #fields.hasErrors('scottCurrency') ? 'has-error' : ''}">
286+
<div class="form-group form-group-sm collapse js-catalogs-info" th:classappend="|${scottHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'in' : ''}|">
264287
<label for="scottNumbers" class="control-label col-sm-3">
265288
<span class="field-label" th:text="#{t_scott}">
266289
Scott
@@ -293,7 +316,7 @@ <h3 th:text="#{t_add_series_ucfirst}">
293316
</div>
294317
</div>
295318

296-
<div class="form-group form-group-sm" th:classappend="${#fields.hasErrors('yvertNumbers') or #fields.hasErrors('yvertPrice') or #fields.hasErrors('yvertCurrency') ? 'has-error' : ''}">
319+
<div class="form-group form-group-sm collapse js-catalogs-info" th:classappend="|${yvertHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'in' : ''}|">
297320
<label for="yvertNumbers" class="control-label col-sm-3">
298321
<span class="field-label" th:text="#{t_yvert}">
299322
Yvert
@@ -326,7 +349,7 @@ <h3 th:text="#{t_add_series_ucfirst}">
326349
</div>
327350
</div>
328351

329-
<div class="form-group form-group-sm" th:classappend="${#fields.hasErrors('gibbonsNumbers') or #fields.hasErrors('gibbonsPrice') or #fields.hasErrors('gibbonsCurrency') ? 'has-error' : ''}">
352+
<div class="form-group form-group-sm collapse js-catalogs-info" th:classappend="|${gibbonsHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'in' : ''}|">
330353
<label for="gibbonsNumbers" class="control-label col-sm-3">
331354
<span class="field-label" th:text="#{t_sg}">
332355
Gibbons
@@ -359,7 +382,15 @@ <h3 th:text="#{t_add_series_ucfirst}">
359382
</div>
360383
</div>
361384

362-
<div class="form-group" th:classappend="${#fields.hasErrors('comment') ? 'has-error' : ''}" sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')">
385+
<div class="form-group js-collapse-toggle-header" sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')">
386+
<div class="col-sm-offset-3 col-sm-5">
387+
<span class="glyphicon glyphicon-chevron-right" th:class="${#fields.hasErrors('comment') ? 'glyphicon glyphicon-chevron-down' : 'glyphicon glyphicon-chevron-right'}"></span>&nbsp;<a href="javascript:void(0)" data-toggle="collapse" data-target=".js-comment" th:text="#{t_add_comment}">
388+
Add comment
389+
</a>
390+
</div>
391+
</div>
392+
393+
<div class="form-group collapse js-comment" th:classappend="${#fields.hasErrors('comment') ? 'has-error in' : ''}" sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')">
363394
<label for="comment" class="control-label col-sm-3">
364395
<span class="field-label" th:text="#{t_comment}">
365396
Comment
@@ -419,6 +450,13 @@ <h3 th:text="#{t_add_series_ucfirst}">
419450
return CatalogUtils.expandNumbers(val);
420451
});
421452
});
453+
454+
$('.collapse').on('show.bs.collapse hide.bs.collapse', function toggleChevron() {
455+
$(this)
456+
.prev('.js-collapse-toggle-header')
457+
.find('.glyphicon')
458+
.toggleClass('glyphicon-chevron-down glyphicon-chevron-right');
459+
});
422460
});
423461
</script>
424462
</body>

0 commit comments

Comments
 (0)