Skip to content

Commit 6c2008b

Browse files
committed
refactor(/series/info.html): extract shared code into a separate <th:block>
Relate to #1280
1 parent 05f975b commit 6c2008b

File tree

1 file changed

+30
-19
lines changed
  • src/main/webapp/WEB-INF/views/series

1 file changed

+30
-19
lines changed

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

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -784,24 +784,14 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
784784
<script src="https://unpkg.com/[email protected]/umd/react.development.js" th:src="${REACT_JS}"></script>
785785
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js" th:src="${REACT_DOM_JS}"></script>
786786
<script src="https://unpkg.com/[email protected]/dist/axios.js" th:src="${AXIOS_JS}"></script>
787-
<script src="../../../../../../target/classes/js/components/SeriesSaleImportForm.js" th:src="${SALE_IMPORT_FORM_JS}"></script>
788787
<script th:inline="javascript">
789-
/*[+
790-
var importFormProps = {
791-
'url': [[ '__@{${IMPORT_SERIES_SALES}}__' ]],
792-
'csrfHeaderName': [[ ${_csrf.headerName} ]],
793-
'csrfTokenValue': [[ ${_csrf.token} ]],
794-
'l10n': {
795-
't_import_info_who_selling_series': [[ #{t_import_info_who_selling_series} ]],
796-
't_could_not_import_info': [[ #{t_could_not_import_info} ]],
797-
't_url': [[ #{t_url} ]],
798-
't_import_info': [[ #{t_import_info} ]]
799-
}
788+
var renderComponent = function(component, props, elementId) {
789+
var rootElement = React.createElement(component, props);
790+
var destNode = document.getElementById(elementId);
791+
ReactDOM.render(rootElement, destNode);
800792
};
801-
+]*/
802793

803794
/*[- */
804-
var importFormProps = { 'l10n': {} };
805795
var responseCount = 0;
806796
window.axios = {
807797
post: function() {
@@ -847,12 +837,33 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
847837
}
848838
};
849839
/* -]*/
850-
851-
var renderComponent = function(component, props, elementId) {
852-
var rootElement = React.createElement(component, props);
853-
var destNode = document.getElementById(elementId);
854-
ReactDOM.render(rootElement, destNode);
840+
</script>
841+
<!--/*/
842+
</th:block>
843+
/*/-->
844+
845+
<!--/*/
846+
<th:block sec:authorize="hasAuthority('IMPORT_SERIES_SALES')">
847+
/*/-->
848+
<script src="../../../../../../target/classes/js/components/SeriesSaleImportForm.js" th:src="${SALE_IMPORT_FORM_JS}"></script>
849+
<script th:inline="javascript">
850+
/*[+
851+
var importFormProps = {
852+
'url': [[ '__@{${IMPORT_SERIES_SALES}}__' ]],
853+
'csrfHeaderName': [[ ${_csrf.headerName} ]],
854+
'csrfTokenValue': [[ ${_csrf.token} ]],
855+
'l10n': {
856+
't_import_info_who_selling_series': [[ #{t_import_info_who_selling_series} ]],
857+
't_could_not_import_info': [[ #{t_could_not_import_info} ]],
858+
't_url': [[ #{t_url} ]],
859+
't_import_info': [[ #{t_import_info} ]]
860+
}
855861
};
862+
+]*/
863+
864+
/*[- */
865+
var importFormProps = { 'l10n': {} };
866+
/* -]*/
856867

857868
renderComponent(SeriesSaleImportForm, importFormProps, 'importSeriesSaleForm');
858869
</script>

0 commit comments

Comments
 (0)