Skip to content

Commit 4844a35

Browse files
Shkarinphp-coder
authored andcommitted
/series/add: fix hidden fields when JS is disabled.
Fix #565
1 parent a4e0266 commit 4844a35

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public final class Url {
8383
public static final String ADD_SERIES_WITH_COUNTRY_PAGE = "/series/add/country/{slug}";
8484

8585
// MUST be updated when any of our resources were modified
86-
public static final String RESOURCES_VERSION = "v0.3.4";
86+
public static final String RESOURCES_VERSION = "v0.3.5";
8787

8888
// CheckStyle: ignore LineLength for next 4 lines
8989
public static final String MAIN_CSS = "/static/" + RESOURCES_VERSION + "/styles/main.min.css";

src/main/javascript/series/add.js

+5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ function initPage(suggestCountryUrl) {
1010
return CatalogUtils.expandNumbers(val);
1111
});
1212
});
13+
14+
$('.js-collapse-toggle-header').show();
1315

1416
$('.collapse').on('show.bs.collapse hide.bs.collapse', function toggleChevron() {
1517
$(this)
1618
.prev('.js-collapse-toggle-header')
1719
.find('.glyphicon')
1820
.toggleClass('glyphicon-chevron-down glyphicon-chevron-right');
1921
});
22+
23+
// emulates collapse('hide') but hides elements faster
24+
$('.collapse').not('.has-error, .js-has-data').height(0).removeClass('in').trigger('hide.bs.collapse');
2025

2126
$('.js-with-tooltip').tooltip({
2227
'placement': 'right'

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

+3
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ label {
102102
.link-vcenter {
103103
line-height: 34px;
104104
}
105+
.js-collapse-toggle-header {
106+
display: none;
107+
}

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

+10-9
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ <h3 th:text="${#strings.capitalize(add_series)}">
244244

245245
<div class="form-group js-collapse-toggle-header">
246246
<div class="col-sm-offset-3 col-sm-5">
247-
<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)" id="specify-issue-date-link" data-toggle="collapse" data-target=".js-issue-date" th:text="#{t_specify_issue_date}">Specify date of release</a>
247+
<span class="glyphicon glyphicon-chevron-down"></span>&nbsp;<a href="javascript:void(0)" id="specify-issue-date-link" data-toggle="collapse" data-target=".js-issue-date" th:text="#{t_specify_issue_date}">Specify date of release</a>
248248
</div>
249249
</div>
250250

251-
<div class="form-group form-group-sm collapse js-issue-date" th:classappend="|${issueDateHasErrors ? 'has-error in' : ''} ${issueDateHasValues ? 'in' : ''}|">
251+
<div class="form-group form-group-sm js-issue-date collapse in" th:classappend="|${issueDateHasErrors ? 'has-error' : ''} ${issueDateHasValues ? 'js-has-data' : ''}|">
252252
<label for="year" class="control-label col-sm-3">
253253
<span th:remove="tag" th:text="#{t_issue_date}">
254254
Date of release
@@ -336,11 +336,12 @@ <h3 th:text="${#strings.capitalize(add_series)}">
336336

337337
<div class="form-group js-collapse-toggle-header">
338338
<div class="col-sm-offset-3 col-sm-7">
339-
<span class="glyphicon glyphicon-chevron-right" th:class="${showCatalogsInfo ? 'glyphicon glyphicon-chevron-down' : 'glyphicon glyphicon-chevron-right'}"></span>&nbsp;<a href="javascript:void(0)" id="add-catalog-numbers-link" data-toggle="collapse" data-target=".js-catalogs-info" th:text="#{t_add_catalogs_info}">Add information from stamps catalogues</a>
339+
<span class="glyphicon glyphicon-chevron-down"></span>&nbsp;
340+
<a href="javascript:void(0)" id="add-catalog-numbers-link" data-toggle="collapse" data-target=".js-catalogs-info" th:text="#{t_add_catalogs_info}">Add information from stamps catalogues</a>
340341
</div>
341342
</div>
342343

343-
<div class="form-group form-group-sm collapse js-catalogs-info" th:classappend="|${michelHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'in' : ''}|">
344+
<div class="form-group form-group-sm js-catalogs-info collapse in" th:classappend="|${michelHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'js-has-data' : ''}|">
344345
<label for="michelNumbers" class="control-label col-sm-3">
345346
<span th:remove="tag" th:text="#{t_michel}">
346347
Michel
@@ -365,7 +366,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
365366
</div>
366367
</div>
367368

368-
<div class="form-group form-group-sm collapse js-catalogs-info" th:classappend="|${scottHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'in' : ''}|">
369+
<div class="form-group form-group-sm js-catalogs-info collapse in" th:classappend="|${scottHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'js-has-data' : ''}|">
369370
<label for="scottNumbers" class="control-label col-sm-3">
370371
<span th:remove="tag" th:text="#{t_scott}">
371372
Scott
@@ -390,7 +391,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
390391
</div>
391392
</div>
392393

393-
<div class="form-group form-group-sm collapse js-catalogs-info" th:classappend="|${yvertHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'in' : ''}|">
394+
<div class="form-group form-group-sm js-catalogs-info collapse in" th:classappend="|${yvertHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'js-has-data' : ''}|">
394395
<label for="yvertNumbers" class="control-label col-sm-3">
395396
<span th:remove="tag" th:text="#{t_yvert}">
396397
Yvert
@@ -415,7 +416,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
415416
</div>
416417
</div>
417418

418-
<div class="form-group form-group-sm collapse js-catalogs-info" th:classappend="|${gibbonsHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'in' : ''}|">
419+
<div class="form-group form-group-sm js-catalogs-info collapse in" th:classappend="|${gibbonsHasErrors ? 'has-error' : ''} ${showCatalogsInfo ? 'js-has-data' : ''}|">
419420
<label for="gibbonsNumbers" class="control-label col-sm-3">
420421
<span th:remove="tag" th:text="#{t_sg}">
421422
Gibbons
@@ -442,11 +443,11 @@ <h3 th:text="${#strings.capitalize(add_series)}">
442443

443444
<div class="form-group js-collapse-toggle-header" sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')">
444445
<div class="col-sm-offset-3 col-sm-5">
445-
<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)" id="add-comment-link" data-toggle="collapse" data-target=".js-comment" th:text="#{t_add_comment}">Add comment</a>
446+
<span class="glyphicon glyphicon-chevron-down"></span>&nbsp;<a href="javascript:void(0)" id="add-comment-link" data-toggle="collapse" data-target=".js-comment" th:text="#{t_add_comment}">Add comment</a>
446447
</div>
447448
</div>
448449

449-
<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')">
450+
<div class="form-group js-comment collapse in" th:classappend="|${#fields.hasErrors('comment') ? 'has-error' : ''} ${addSeriesForm.comment != null ? 'js-has-data' : ''}|" sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')">
450451
<label for="comment" class="control-label col-sm-3">
451452
<span th:remove="tag" th:text="#{t_comment}">
452453
Comment

0 commit comments

Comments
 (0)