|
2 | 2 | <html lang="en" th:lang="${#locale.language == 'ru' ? 'ru' : 'en'}"
|
3 | 3 | xmlns="http://www.w3.org/1999/xhtml"
|
4 | 4 | xmlns:th="http://www.thymeleaf.org"
|
5 |
| - xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"> |
| 5 | + xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" |
| 6 | + xmlns:togglz="https://github.com/heneke/thymeleaf-extras-togglz"> |
6 | 7 | <head>
|
7 | 8 | <meta charset="utf-8" />
|
8 | 9 | <meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
@@ -559,7 +560,7 @@ <h5 class="text-center" th:text="#{t_similar_series}">
|
559 | 560 | /*/-->
|
560 | 561 | </div>
|
561 | 562 |
|
562 |
| - <div class="row" th:if="${not #lists.isEmpty(seriesSales)}" sec:authorize="hasAuthority('VIEW_SERIES_SALES')"> |
| 563 | + <div class="row" th:if="${not #lists.isEmpty(seriesSales)}" sec:authorize="hasAuthority('VIEW_SERIES_SALES')" togglz:inactive="USE_REACT"> |
563 | 564 | <div class="col-sm-12">
|
564 | 565 | <h5 th:text="#{t_who_selling_series}">Who was selling/buying this series</h5>
|
565 | 566 | <ul th:remove="all-but-first">
|
@@ -623,6 +624,8 @@ <h5 th:text="#{t_who_selling_series}">Who was selling/buying this series</h5>
|
623 | 624 | </div>
|
624 | 625 | </div>
|
625 | 626 |
|
| 627 | + <div id="series-sales-list" sec:authorize="hasAuthority('VIEW_SERIES_SALES')" togglz:active="USE_REACT"></div> |
| 628 | + |
626 | 629 | <div class="row" sec:authorize="hasAuthority('ADD_SERIES_SALES')">
|
627 | 630 | <div class="col-sm-12">
|
628 | 631 | <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying this series</h5>
|
@@ -999,6 +1002,105 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
|
999 | 1002 |
|
1000 | 1003 | responseCount++;
|
1001 | 1004 |
|
| 1005 | + return new Promise(function delayExecution(resolve) { |
| 1006 | + setTimeout(resolve, 500 /* 0.5 second */); |
| 1007 | + |
| 1008 | + }).then(function returnResponse() { |
| 1009 | + return stubResponse.status == 500 ? Promise.reject(stubResponse) : Promise.resolve(stubResponse); |
| 1010 | + }); |
| 1011 | + }, |
| 1012 | + get: function (url) { |
| 1013 | + var possibleOutcomes = [ 'success']; |
| 1014 | + var outcome = possibleOutcomes[responseCount % possibleOutcomes.length]; |
| 1015 | + var possibleResponses = { |
| 1016 | + '/series/100': { |
| 1017 | + 'success': { |
| 1018 | + status: 200, |
| 1019 | + data: [ |
| 1020 | + { |
| 1021 | + id: 1, |
| 1022 | + sellerName: 'James Alan Hetfield', |
| 1023 | + sellerUrl: 'http://example.com/james-alan-hetfield', |
| 1024 | + buyerName: 'Eicca Toppinen', |
| 1025 | + buyerUrl: 'http://example.com/eicca-toppinen', |
| 1026 | + transactionUrl: 'http://example.com/james-alan-hetfield/selling-stamps', |
| 1027 | + firstPrice: 100, |
| 1028 | + firstCurrency: 'USD', |
| 1029 | + condition: 'CANCELLED' |
| 1030 | + }, |
| 1031 | + { |
| 1032 | + id: 2, |
| 1033 | + sellerName: 'James Alan Hetfield', |
| 1034 | + sellerUrl: 'http://example.com/james-alan-hetfield', |
| 1035 | + transactionUrl: 'http://example.com/james-alan-hetfield/selling-stamps', |
| 1036 | + firstPrice: 100, |
| 1037 | + firstCurrency: 'USD', |
| 1038 | + secondPrice: 650, |
| 1039 | + secondCurrency: 'RUB', |
| 1040 | + condition: 'CANCELLED' |
| 1041 | + }, |
| 1042 | + { |
| 1043 | + id: 3, |
| 1044 | + date: '02.02.2002', |
| 1045 | + sellerName: 'Tommy Lee Jones', |
| 1046 | + sellerUrl: 'http://example.com/tommy-lee-jones', |
| 1047 | + transactionUrl: 'http://example.com/tommy-lee-jones/selling-stamps', |
| 1048 | + firstPrice: 200, |
| 1049 | + firstCurrency: 'USD', |
| 1050 | + condition: 'MNH' |
| 1051 | + }, |
| 1052 | + { |
| 1053 | + id: 4, |
| 1054 | + date: '02.02.2002', |
| 1055 | + sellerName: 'Tommy Lee Jones', |
| 1056 | + sellerUrl: 'http://example.com/tommy-lee-jones', |
| 1057 | + transactionUrl: 'http://example.com/tommy-lee-jones/selling-stamps', |
| 1058 | + firstPrice: 200, |
| 1059 | + firstCurrency: 'USD', |
| 1060 | + secondPrice: 1300, |
| 1061 | + secondCurrency: 'RUB', |
| 1062 | + }, |
| 1063 | + { |
| 1064 | + id: 5, |
| 1065 | + date: '03.02.2002', |
| 1066 | + sellerName: 'Eicca Toppinen', |
| 1067 | + sellerUrl: 'http://example.com/eicca-toppinen', |
| 1068 | + transactionUrl: 'http://example.com/tommy-lee-jones/selling-stamps', |
| 1069 | + firstPrice: 300, |
| 1070 | + firstCurrency: 'USD', |
| 1071 | + secondPrice: 1560, |
| 1072 | + secondCurrency: 'RUB', |
| 1073 | + }, |
| 1074 | + { |
| 1075 | + id: 6, |
| 1076 | + date: '03.02.2002', |
| 1077 | + sellerName: 'Eicca Toppinen', |
| 1078 | + sellerUrl: 'http://example.com/eicca-toppinen', |
| 1079 | + buyerName: 'Kurt Cobain', |
| 1080 | + firstPrice: 300, |
| 1081 | + firstCurrency: 'USD', |
| 1082 | + secondPrice: 1560, |
| 1083 | + secondCurrency: 'RUB', |
| 1084 | + } |
| 1085 | + ] |
| 1086 | + } |
| 1087 | + } |
| 1088 | + }; |
| 1089 | + var stubResponse; |
| 1090 | + |
| 1091 | + switch (outcome) { |
| 1092 | + case 'success': |
| 1093 | + stubResponse = possibleResponses[url][outcome]; |
| 1094 | + break; |
| 1095 | + default: |
| 1096 | + stubResponse = { |
| 1097 | + status: 500, |
| 1098 | + statusText: 'Fake Server Error' |
| 1099 | + }; |
| 1100 | + } |
| 1101 | + |
| 1102 | + responseCount++; |
| 1103 | + |
1002 | 1104 | return new Promise(function delayExecution(resolve) {
|
1003 | 1105 | setTimeout(resolve, 500 /* 0.5 second */);
|
1004 | 1106 |
|
@@ -1105,6 +1207,39 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
|
1105 | 1207 | </th:block>
|
1106 | 1208 | /*/-->
|
1107 | 1209 |
|
| 1210 | + <!--/*/ |
| 1211 | + <th:block sec:authorize="hasAuthority('VIEW_SERIES_SALES')" togglz:active="USE_REACT"> |
| 1212 | + /*/--> |
| 1213 | + <script src="../../../../../../target/classes/js/components/SeriesSalesList.js" th:src="${SERIES_SALES_LIST_JS}"></script> |
| 1214 | + |
| 1215 | + <script th:inline="javascript"> |
| 1216 | + /*[+ |
| 1217 | + var seriesSalesListProps = { |
| 1218 | + 'url': [[ '__@{${INFO_SERIES_PAGE}(id=${series.id})}__' ]], |
| 1219 | + 'l10n': { |
| 1220 | + 't_server_error': [[ #{t_server_error} ]], |
| 1221 | + 't_who_selling_series': [[ #{t_who_selling_series} ]], |
| 1222 | + 't_sold_to': [[ #{t_sold_to} ]], |
| 1223 | + 't_sold_for': [[ #{t_sold_for} ]], |
| 1224 | + 't_was_selling': [[ #{t_was_selling} ]], |
| 1225 | + 't_cancelled': [[ #{t_cancelled} ]] |
| 1226 | + } |
| 1227 | + }; |
| 1228 | + +]*/ |
| 1229 | + |
| 1230 | + /*[- */ |
| 1231 | + var seriesSalesListProps = { |
| 1232 | + 'url': '/series/100', |
| 1233 | + 'l10n': {} |
| 1234 | + }; |
| 1235 | + /* -]*/ |
| 1236 | + |
| 1237 | + renderComponent(SeriesSalesList, seriesSalesListProps, 'series-sales-list'); |
| 1238 | + </script> |
| 1239 | + <!--/*/ |
| 1240 | + </th:block> |
| 1241 | + /*/--> |
| 1242 | + |
1108 | 1243 | <!--/*/
|
1109 | 1244 | <th:block sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')" th:if="${series.comment == null}">
|
1110 | 1245 | /*/-->
|
|
0 commit comments