Skip to content

Commit 9fb0d33

Browse files
committed
task: add an empty AddCommentForm.
Address to #1338 Part of #785
1 parent 6159372 commit 9fb0d33

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// IMPORTANT:
3+
// You must update ResourceUrl.RESOURCES_VERSION each time whenever you're modified this file!
4+
//
5+
6+
class AddCommentForm extends React.Component {
7+
8+
render() {
9+
return (
10+
<div>TODO: add comment form</div>
11+
)
12+
}
13+
}

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

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public final class ResourceUrl {
4545
// @todo #1057 Use minified version of SeriesSaleImportForm.js
4646
private static final String SALE_IMPORT_FORM_JS = "/public/js/" + RESOURCES_VERSION + "/components/SeriesSaleImportForm.js";
4747
private static final String SIMILAR_SERIES_FORM_JS = "/public/js/" + RESOURCES_VERSION + "/components/SimilarSeriesForm.js";
48+
private static final String ADD_COMMENT_FORM_JS = "/public/js/" + RESOURCES_VERSION + "/components/AddCommentForm.js";
4849
private static final String BOOTSTRAP_LANGUAGE = "https://cdn.jsdelivr.net/gh/usrz/bootstrap-languages@3ac2a3d2b27ac43a471cd99e79d378a03b2c6b5f/languages.min.css";
4950
private static final String FAVICON_ICO = "/favicon.ico";
5051

@@ -80,6 +81,7 @@ public static void exposeResourcesToView(Map<String, String> resources, String h
8081
put(resources, host, "SERIES_INFO_JS", SERIES_INFO_JS);
8182
put(resources, host, "SALE_IMPORT_FORM_JS", SALE_IMPORT_FORM_JS);
8283
put(resources, host, "SIMILAR_SERIES_FORM_JS", SIMILAR_SERIES_FORM_JS);
84+
put(resources, host, "ADD_COMMENT_FORM_JS", ADD_COMMENT_FORM_JS);
8385
}
8486

8587
// see also MvcConfig.addResourceHandlers()

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

+31-1
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ <h5 th:text="#{t_hidden_images}">Hidden images</h5>
391391
</dl>
392392
</div>
393393
</div>
394+
395+
<div id="add-comment" sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')"></div>
396+
394397
<div id="similar-series" class="row" th:if="${not #lists.isEmpty(similarSeries)}">
395398
<div class="col-sm-10 col-sm-offset-2">
396399
<h5 class="text-center" th:text="#{t_similar_series}">
@@ -835,7 +838,7 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
835838
th:src="${SERIES_INFO_JS}"></script>
836839

837840
<!--/*/
838-
<th:block sec:authorize="hasAnyAuthority('IMPORT_SERIES_SALES', 'MARK_SIMILAR_SERIES')">
841+
<th:block sec:authorize="hasAnyAuthority('IMPORT_SERIES_SALES', 'MARK_SIMILAR_SERIES', 'ADD_COMMENTS_TO_SERIES')">
839842
/*/-->
840843
<script src="https://unpkg.com/[email protected]/umd/react.development.js" th:src="${REACT_JS}"></script>
841844
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js" th:src="${REACT_DOM_JS}"></script>
@@ -920,6 +923,33 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
920923
</th:block>
921924
/*/-->
922925

926+
<!--/*/
927+
<th:block sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')">
928+
/*/-->
929+
<script src="../../../../../../target/classes/js/components/AddCommentForm.js" th:src="${ADD_COMMENT_FORM_JS}"></script>
930+
<script th:inline="javascript">
931+
/*[+
932+
var addCommentProps = {
933+
'csrfHeaderName': [[ ${_csrf.headerName} ]],
934+
'csrfTokenValue': [[ ${_csrf.token} ]],
935+
'l10n': {
936+
}
937+
};
938+
+]*/
939+
940+
/*[- */
941+
var addCommentProps = {
942+
'url': '/series/100',
943+
'l10n': {}
944+
};
945+
/* -]*/
946+
947+
renderComponent(AddCommentForm, addCommentProps, 'add-comment');
948+
</script>
949+
<!--/*/
950+
</th:block>
951+
/*/-->
952+
923953
<!--/* @todo #1280 Mark similar series: add integration tests */-->
924954
<!--/*/
925955
<th:block sec:authorize="hasAuthority('MARK_SIMILAR_SERIES')">

0 commit comments

Comments
 (0)