Browse Source

Move shop basket texts to html file

Vova Tkach 5 years ago
parent
commit
7732e00a76

+ 13 - 0
assets/template/header_html_file.go

@@ -19,6 +19,19 @@ var VarHeaderHtmlFile = []byte(`<!doctype html>
 
 		<!-- Template CSS file from template folder -->
 		<link rel="stylesheet" href="{{$.System.PathThemeStyles}}">
+
+		<!-- Shop basket texts -->
+		<script type="text/javascript">
+			var ShopBasketName = 'Basket';
+			var ShopBasketTableProduct = 'Product';
+			var ShopBasketTablePrice = 'Price';
+			var ShopBasketTableQuantity = 'Quantity';
+			var ShopBasketTableSum = 'Sum';
+			var ShopBasketTotal = 'Total sum:';
+			var ShopBasketBtnContinue = 'Continue Shopping';
+			var ShopBasketBtnOrder = 'Make order';
+			var ShopBasketEmpty = 'You basket currently empty...';
+		</script>
 	</head>
 	<body id="body" class="fixed-top-bar">
 		<div id="sys-modal-shop-basket-placeholder"></div>

+ 6 - 6
assets/template/scripts_js_file.go

@@ -103,7 +103,7 @@ var VarScriptsJsFile = []byte(`(function(window, $) {
 					if(data.total_count != undefined && data.total_count > 0) {
 						var table = '';
 						table += '<table class="table data-table table-striped table-bordered">';
-						table += '<thead><tr><th class="thc-1">&nbsp;</th><th class="thc-2">Product</th><th class="thc-3">Price</th><th class="thc-4">Quantity</th><th class="thc-5">Sum</th><th class="thc-6">&nbsp;</th></tr></thead>';
+						table += '<thead><tr><th class="thc-1">&nbsp;</th><th class="thc-2">' + ShopBasketTableProduct + '</th><th class="thc-3">' + ShopBasketTablePrice + '</th><th class="thc-4">' + ShopBasketTableQuantity + '</th><th class="thc-5">' + ShopBasketTableSum + '</th><th class="thc-6">&nbsp;</th></tr></thead>';
 						table += '<tbody>';
 						for(var i in data.products) {
 							table += '<tr>';
@@ -117,10 +117,10 @@ var VarScriptsJsFile = []byte(`(function(window, $) {
 						}
 						table += '</tbody>';
 						table += '</table>';
-						table += '<div class="total"><span class="caption">Total sum:</span><span class="value">' + data.total_sum + ' ' + data.currency.code + '</span></div>';
+						table += '<div class="total"><span class="caption">' + ShopBasketTotal + '</span><span class="value">' + data.total_sum + ' ' + data.currency.code + '</span></div>';
 						if(success) { success(table, data.total_count); }
 					} else {
-						if(success) { success('You basket currently empty...', 0); }
+						if(success) { success(ShopBasketEmpty, 0); }
 					}
 				} else {
 					window.location.reload(true);
@@ -171,7 +171,7 @@ var VarScriptsJsFile = []byte(`(function(window, $) {
 							<div class="modal-content"> \
 								<input type="hidden" name="action" value="index-user-update-profile"> \
 								<div class="modal-header"> \
-									<h5 class="modal-title" id="sysModalShopBasketLabel">Basket</h5> \
+									<h5 class="modal-title" id="sysModalShopBasketLabel">' + ShopBasketName + '</h5> \
 									<button type="button" class="close" data-dismiss="modal" aria-label="Close"> \
 										<span aria-hidden="true">&times;</span> \
 									</button> \
@@ -181,8 +181,8 @@ var VarScriptsJsFile = []byte(`(function(window, $) {
 									<div class="data"></div> \
 								</div> \
 								<div class="modal-footer"> \
-									<button type="button" class="btn btn-close btn-secondary" data-dismiss="modal">Continue Shopping</button> \
-									<button type="button" class="btn btn-order btn-success" disabled>Make order</button> \
+									<button type="button" class="btn btn-close btn-secondary" data-dismiss="modal">' + ShopBasketBtnContinue + '</button> \
+									<button type="button" class="btn btn-order btn-success" disabled>' + ShopBasketBtnOrder + '</button> \
 								</div> \
 							</div> \
 						</div> \

+ 13 - 0
hosts/localhost/template/header.html

@@ -17,6 +17,19 @@
 
 		<!-- Template CSS file from template folder -->
 		<link rel="stylesheet" href="{{$.System.PathThemeStyles}}">
+
+		<!-- Shop basket texts -->
+		<script type="text/javascript">
+			var ShopBasketName = 'Basket';
+			var ShopBasketTableProduct = 'Product';
+			var ShopBasketTablePrice = 'Price';
+			var ShopBasketTableQuantity = 'Quantity';
+			var ShopBasketTableSum = 'Sum';
+			var ShopBasketTotal = 'Total sum:';
+			var ShopBasketBtnContinue = 'Continue Shopping';
+			var ShopBasketBtnOrder = 'Make order';
+			var ShopBasketEmpty = 'You basket currently empty...';
+		</script>
 	</head>
 	<body id="body" class="fixed-top-bar">
 		<div id="sys-modal-shop-basket-placeholder"></div>

+ 6 - 6
hosts/localhost/template/scripts.js

@@ -101,7 +101,7 @@
 					if(data.total_count != undefined && data.total_count > 0) {
 						var table = '';
 						table += '<table class="table data-table table-striped table-bordered">';
-						table += '<thead><tr><th class="thc-1">&nbsp;</th><th class="thc-2">Product</th><th class="thc-3">Price</th><th class="thc-4">Quantity</th><th class="thc-5">Sum</th><th class="thc-6">&nbsp;</th></tr></thead>';
+						table += '<thead><tr><th class="thc-1">&nbsp;</th><th class="thc-2">' + ShopBasketTableProduct + '</th><th class="thc-3">' + ShopBasketTablePrice + '</th><th class="thc-4">' + ShopBasketTableQuantity + '</th><th class="thc-5">' + ShopBasketTableSum + '</th><th class="thc-6">&nbsp;</th></tr></thead>';
 						table += '<tbody>';
 						for(var i in data.products) {
 							table += '<tr>';
@@ -115,10 +115,10 @@
 						}
 						table += '</tbody>';
 						table += '</table>';
-						table += '<div class="total"><span class="caption">Total sum:</span><span class="value">' + data.total_sum + ' ' + data.currency.code + '</span></div>';
+						table += '<div class="total"><span class="caption">' + ShopBasketTotal + '</span><span class="value">' + data.total_sum + ' ' + data.currency.code + '</span></div>';
 						if(success) { success(table, data.total_count); }
 					} else {
-						if(success) { success('You basket currently empty...', 0); }
+						if(success) { success(ShopBasketEmpty, 0); }
 					}
 				} else {
 					window.location.reload(true);
@@ -169,7 +169,7 @@
 							<div class="modal-content"> \
 								<input type="hidden" name="action" value="index-user-update-profile"> \
 								<div class="modal-header"> \
-									<h5 class="modal-title" id="sysModalShopBasketLabel">Basket</h5> \
+									<h5 class="modal-title" id="sysModalShopBasketLabel">' + ShopBasketName + '</h5> \
 									<button type="button" class="close" data-dismiss="modal" aria-label="Close"> \
 										<span aria-hidden="true">&times;</span> \
 									</button> \
@@ -179,8 +179,8 @@
 									<div class="data"></div> \
 								</div> \
 								<div class="modal-footer"> \
-									<button type="button" class="btn btn-close btn-secondary" data-dismiss="modal">Continue Shopping</button> \
-									<button type="button" class="btn btn-order btn-success" disabled>Make order</button> \
+									<button type="button" class="btn btn-close btn-secondary" data-dismiss="modal">' + ShopBasketBtnContinue + '</button> \
+									<button type="button" class="btn btn-order btn-success" disabled>' + ShopBasketBtnOrder + '</button> \
 								</div> \
 							</div> \
 						</div> \