can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[ljcom] r11360: LJSUP-10748: Free2pay

Committer: dpetrov
LJSUP-10748: Free2pay
U   trunk/htdocs/js/pay.js
U   trunk/templates/Shop/Wallet.tmpl
Modified: trunk/htdocs/js/pay.js
===================================================================
--- trunk/htdocs/js/pay.js	2012-01-27 13:15:24 UTC (rev 11359)
+++ trunk/htdocs/js/pay.js	2012-01-27 15:08:34 UTC (rev 11360)
@@ -209,6 +209,27 @@
 				return confirm(ml_confirm_transfer.replace('{{tokens}}', tokens));
 			} // else send and show server side error
 		});
+
+		var freeToPay = jQuery('.b-wallet-tokens-free');
+		if (freeToPay.length > 0) {
+			var template = jQuery.template(null, $('ljshop_freetopay')),
+				url = freeToPay.data('href');
+
+				jQuery.ajax({
+					jsonp: 'jsonp',
+					url: url,
+					dataType: 'jsonp',
+					complete: function(ans) {
+						if (ans.responseText && ans.responseText.Offers) {
+							jQuery.tmpl(template, ans.responseText.Offers).appendTo(freeToPay);
+						}
+					}
+				});
+
+			freeToPay.delegate('.b-btn', 'click', function(ev) {
+				jQuery(this).closest('form').get(0).submit();
+			});
+		}
 	},
 	
 	walletOfferpalSubmit: function()

Modified: trunk/templates/Shop/Wallet.tmpl
===================================================================
--- trunk/templates/Shop/Wallet.tmpl	2012-01-27 13:15:24 UTC (rev 11359)
+++ trunk/templates/Shop/Wallet.tmpl	2012-01-27 15:08:34 UTC (rev 11360)
@@ -77,33 +77,24 @@
 		<p><TMPL_VAR proceed_xfer_btn></p>
 		</form>
 	</li>
-	<li class="b-wallet-tokens-item b-wallet-tokens-free<TMPL_IF name='tab_tokens_free'> current</TMPL_IF>">
-		<!--
-		sid: <TMPL_VAR sid>
-		uid: <TMPL_VAR uid>
-		sex: <TMPL_VAR sex>
-		age: <TMPL_VAR age>
-		location: <TMPL_VAR location>
-		http://www.freetopay.ru/get_offers.php?sid=<TMPL_VAR sid>&amp;uid=<TMPL_VAR uid>&amp;sex=<TMPL_VAR sex>&amp;age=<TMPL_VAR age>&amp;location=<TMPL_VAR location>
-		-->
-
-		<!--
-		EACH FORM MUST BE INSERTED BY JABASCRIPT
-		<form action="<TMPL_VAR self_uri>" method="post">
+	<li class="b-wallet-tokens-item b-wallet-tokens-free<TMPL_IF name='tab_tokens_free'> current</TMPL_IF>"
+					data-href="<TMPL_VAR ftp_url>">
+		<script type="text/x-jquery-tmpl" id="ljshop_freetopay">
+		<form action="${URL}" method="post">
 			<div class="b-wallet-tokens-free-icon">
-				<img src="/img/sapato.png?v=14198" alt="SAPATO" width="70" />
+				<img src="${Logo}" alt="${Name}" width="70" />
 			</div>
 			<div class="b-wallet-tokens-free-content">
 				<p class="b-ribbon"><span>Free</span></p>
-				<h2>Скидки и бонусы вокруг вас!</h2>
-				<p>Зарегистрируйтесь на сайте AlterGEO бла-бла-бла. Зарегистрируйтесь на сайте AlterGEO бла-бла-бла. Зарегистрируйтесь на сайте AlterGEO.</p>
+				<h2>${Name}</h2>
+				<p>${Description}</p>
 				<p>
 					<span class="b-btn">Получить</span>
-					<span class="b-wallet-tokens-free-amount">100 шт</span>
+					<span class="b-wallet-tokens-free-amount">${VCReceive}</span>
 				</p>
 			</div>
 		</form>
-		-->
+		</script>
 	</li>
 </ul>
 

Tags: can3p, dpetrov, js, ljcom, tmpl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments