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
@@ -1019,6 +1121,8 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
1019
1121
< script src ="../../../../../../target/classes/js/components/AddReleaseYearForm.js " th:src ="${RELEASE_YEAR_FORM_JS} "> </ script >
1020
1122
< script src ="../../../../../../target/classes/js/components/AddCatalogPriceForm.js " th:src ="${CATALOG_PRICE_FORM_JS} "> </ script >
1021
1123
< script src ="../../../../../../target/classes/js/components/AddCatalogNumbersForm.js " th:src ="${CATALOG_NUMBERS_FORM_JS} "> </ script >
1124
+ < script src ="../../../../../../target/classes/js/components/SeriesSalesList.js " th:src ="${SERIES_SALES_LIST_JS} "> </ script >
1125
+
1022
1126
1023
1127
< script th:inline ="javascript ">
1024
1128
/*[+
@@ -1057,6 +1161,12 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
1057
1161
't_add': [[ #{t_add} ]]
1058
1162
}
1059
1163
};
1164
+ var seriesSalesListProps = {
1165
+ 'url': [[ '__@{${INFO_SERIES_PAGE}(id=${series.id})}__' ]],
1166
+ 'l10n': {
1167
+ 't_server_error': [[ #{t_server_error} ]],
1168
+ }
1169
+ };
1060
1170
+]*/
1061
1171
1062
1172
/*[- */
@@ -1074,10 +1184,17 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
1074
1184
'url' : '/series/100' ,
1075
1185
'l10n' : { }
1076
1186
} ;
1187
+
1188
+ var seriesSalesListProps = {
1189
+ 'url' : '/series/100' ,
1190
+ 'l10n' : { }
1191
+ } ;
1077
1192
/* -]*/
1078
1193
1079
1194
renderComponent ( AddCatalogPriceForm , addCatalogPriceProps , 'add-catalog-price' ) ;
1080
1195
renderComponent ( AddCatalogNumbersForm , addCatalogNumbersProps , 'add-catalog-numbers' ) ;
1196
+ renderComponent ( SeriesSalesList , seriesSalesListProps , 'series-sales-list' ) ;
1197
+
1081
1198
1082
1199
/*[# th:if="${series.releaseYear == null}"]*/
1083
1200
/*[+
0 commit comments