Skip to content

Commit 87962a3

Browse files
committed
/series/add: show filled fields when errors have occurred.
Fix #203
1 parent a2e1bd3 commit 87962a3

File tree

1 file changed

+11
-6
lines changed
  • src/main/webapp/WEB-INF/views/series

1 file changed

+11
-6
lines changed

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,16 @@ <h3 th:text="#{t_add_series_ucfirst}">
6868
th:action="@{${ADD_SERIES_PAGE}} + '?' + ${_csrf.parameterName} + '=' + ${_csrf.token}"
6969
th:object="${addSeriesForm}"
7070
th:with="michelHasErrors=${#fields.hasErrors('michelNumbers') or #fields.hasErrors('michelPrice')},
71+
michelHasValues=${addSeriesForm.michelNumbers != null or addSeriesForm.michelPrice != null},
7172
scottHasErrors=${#fields.hasErrors('scottNumbers') or #fields.hasErrors('scottPrice')},
73+
scottHasValues=${addSeriesForm.scottNumbers != null or addSeriesForm.scottPrice != null},
7274
yvertHasErrors=${#fields.hasErrors('yvertNumbers') or #fields.hasErrors('yvertPrice')},
75+
yvertHasValues=${addSeriesForm.yvertNumbers != null or addSeriesForm.yvertPrice != null},
7376
gibbonsHasErrors=${#fields.hasErrors('gibbonsNumbers') or #fields.hasErrors('gibbonsPrice')},
74-
showCatalogsInfo=${michelHasErrors or scottHasErrors or yvertHasErrors or gibbonsHasErrors},
75-
issueDateHasErrors=${#fields.hasErrors('day') or #fields.hasErrors('month') or #fields.hasErrors('year')}">
77+
gibbonsHasValues=${addSeriesForm.gibbonsNumbers != null or addSeriesForm.gibbonsPrice != null},
78+
showCatalogsInfo=${michelHasErrors or michelHasValues or scottHasErrors or scottHasValues or yvertHasErrors or yvertHasValues or gibbonsHasErrors or gibbonsHasValues},
79+
issueDateHasErrors=${#fields.hasErrors('day') or #fields.hasErrors('month') or #fields.hasErrors('year')},
80+
issueDateHasValues=${addSeriesForm.day != null or addSeriesForm.month != null or addSeriesForm.year != null}">
7681

7782
<div class="form-group form-group-sm" th:classappend="${#fields.hasErrors('category') ? 'has-error' : ''}">
7883
<label for="category" class="control-label col-sm-3">
@@ -172,13 +177,13 @@ <h3 th:text="#{t_add_series_ucfirst}">
172177

173178
<div class="form-group js-collapse-toggle-header">
174179
<div class="col-sm-offset-3 col-sm-5">
175-
<span class="glyphicon glyphicon-chevron-right" th:class="${issueDateHasErrors ? '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}">
180+
<span class="glyphicon glyphicon-chevron-right" th:class="${issueDateHasErrors or issueDateHasValues ? '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}">
176181
Specify date of release
177182
</a>
178183
</div>
179184
</div>
180185

181-
<div class="form-group form-group-sm collapse js-issue-date" th:classappend="${issueDateHasErrors ? 'has-error in' : ''}">
186+
<div class="form-group form-group-sm collapse js-issue-date" th:classappend="|${issueDateHasErrors ? 'has-error in' : ''} ${issueDateHasValues ? 'in' : ''}|">
182187
<label for="year" class="control-label col-sm-3">
183188
<span class="field-label" th:text="#{t_issue_date}">
184189
Date of release
@@ -372,13 +377,13 @@ <h3 th:text="#{t_add_series_ucfirst}">
372377

373378
<div class="form-group js-collapse-toggle-header" sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')">
374379
<div class="col-sm-offset-3 col-sm-5">
375-
<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}">
380+
<span class="glyphicon glyphicon-chevron-right" th:class="${#fields.hasErrors('comment') or addSeriesForm.comment != null ? '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}">
376381
Add comment
377382
</a>
378383
</div>
379384
</div>
380385

381-
<div class="form-group collapse js-comment" th:classappend="${#fields.hasErrors('comment') ? 'has-error in' : ''}" sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')">
386+
<div class="form-group collapse js-comment" th:classappend="|${#fields.hasErrors('comment') ? 'has-error in' : ''} ${addSeriesForm.comment != null ? 'in' : ''}|" sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')">
382387
<label for="comment" class="control-label col-sm-3">
383388
<span class="field-label" th:text="#{t_comment}">
384389
Comment

0 commit comments

Comments
 (0)