Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r11963: LJSUP-12206 (Remove SMS payments as a pa...

Committer: ailyin
LJSUP-12206 (Remove SMS payments as a payment option): change that widget to use a template; refactoring, no functional changes for now
U   trunk/cgi-bin/LJ/Widget/Shop/PaymentMethods.pm
A   trunk/templates/Shop/PaymentMethods.tmpl
Modified: trunk/cgi-bin/LJ/Widget/Shop/PaymentMethods.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/PaymentMethods.pm	2012-05-16 06:16:57 UTC (rev 11962)
+++ trunk/cgi-bin/LJ/Widget/Shop/PaymentMethods.pm	2012-05-16 06:20:27 UTC (rev 11963)
@@ -12,50 +12,17 @@
 
 sub render_body {
     my ($self, %opts) = @_;
-    my $ret = '';
 
-    my $ml_title = LJ::Lang::ml('/shop/index.bml.storefront.paymentmethods.title');
-    $ret .= qq{
-            <div class="right-mod"><div class="mod-tl"><div class="mod-tr"><div class="mod-br"><div class="mod-bl">
-            <div class="w-head">
-                <h2><span class='w-head-in'>$ml_title</span></h2><i class="w-head-corner"></i>
-            </div>
-            <div class="w-body">
-    };
-    if (LJ::SUP->is_remote_sup) {
-        my $ml_yandex_money
-            = LJ::Lang::ml('/shop/index.bml.storefront.paymentmethods.yad');
+    my $template = LJ::HTML::Template->new(
+        { 'use_expr' => 1 },
+        'filename' => "$ENV{'LJHOME'}/templates/Shop/PaymentMethods.tmpl",
+    );
 
-        my $ml_sup_text
-            = LJ::Lang::ml('/shop/index.bml.storefront.paymentmethods.sup_text');
+    $template->param(
+        'remote_sup' => LJ::SUP->is_remote_sup || undef,
+    );
 
-        $ret .= qq{
-                 <a href="$LJ::SITEROOT/support/faqbrowse.bml?faqid=21#methods" class="paymentmethods-logos">
-                     <img src="$LJ::IMGPREFIX/shop/payment/paypal.png?v=7016" alt="PayPal" />
-                     <img src="$LJ::IMGPREFIX/shop/payment/yad.png?v=7183" alt="$ml_yandex_money" />
-                     <img src="$LJ::IMGPREFIX/shop/payment/webmoney.png?v=7016" alt="WebMoney" /><br />
-                     <img src="$LJ::IMGPREFIX/shop/payment/visa.png?v=7016" alt="VISA" />
-                     <img src="$LJ::IMGPREFIX/shop/payment/mastercard.png?v=7016" alt="MasterCard" />
-                     <img src="$LJ::IMGPREFIX/shop/payment/aexpress.png?v=7016" alt="American Expess" />
-                     <img src="$LJ::IMGPREFIX/shop/payment/dnovus.png?v=7016" alt="Discover Novus" />
-                </a>
-                 <span class="shop-payment-text-link"><a href="$LJ::SITEROOT/sup/sms_tos.bml">$ml_sup_text</a></span>
-        };
-    } else {
-        $ret .= qq{ 
-            <a href="$LJ::SITEROOT/support/faqbrowse.bml?faqid=21#methods" class="paymentmethods-logos">
-                 <img src="$LJ::IMGPREFIX/shop/payment/paypal.png?v=7016" alt="PayPal" />
-                 <img src="$LJ::IMGPREFIX/shop/payment/webmoney.png?v=7016" alt="WebMoney" /><br />
-                 <img src="$LJ::IMGPREFIX/shop/payment/visa.png?v=7016" alt="VISA" />
-                 <img src="$LJ::IMGPREFIX/shop/payment/mastercard.png?v=7016" alt="MasterCard" />
-                 <img src="$LJ::IMGPREFIX/shop/payment/aexpress.png?v=7016" alt="American Expess" />
-                 <img src="$LJ::IMGPREFIX/shop/payment/dnovus.png?v=7016" alt="Discover Novus" />
-            </a>
-        };
-    }
-    $ret .='</div></div></div></div></div></div>';
-    return $ret;
-
+    return $template->output;
 }
 
 1;

Added: trunk/templates/Shop/PaymentMethods.tmpl
===================================================================
--- trunk/templates/Shop/PaymentMethods.tmpl	                        (rev 0)
+++ trunk/templates/Shop/PaymentMethods.tmpl	2012-05-16 06:20:27 UTC (rev 11963)
@@ -0,0 +1,29 @@
+<div class="right-mod"><div class="mod-tl"><div class="mod-tr"><div class="mod-br"><div class="mod-bl">
+<div class="w-head">
+    <h2><span class='w-head-in'><TMPL_VAR expr="ml('/shop/index.bml.storefront.paymentmethods.title')"></span></h2><i class="w-head-corner"></i>
+</div>
+<div class="w-body">
+
+<TMPL_IF remote_sup>
+    <a href="<TMPL_VAR lj_siteroot>/support/faqbrowse.bml?faqid=21#methods" class="paymentmethods-logos">
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/paypal.png?v=7016" alt="PayPal" />
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/yad.png?v=7183" alt="<TMPL_VAR expr="ml('/shop/index.bml.storefront.paymentmethods.yad')">" />
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/webmoney.png?v=7016" alt="WebMoney" /><br />
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/visa.png?v=7016" alt="VISA" />
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/mastercard.png?v=7016" alt="MasterCard" />
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/aexpress.png?v=7016" alt="American Expess" />
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/dnovus.png?v=7016" alt="Discover Novus" />
+    </a>
+    <span class="shop-payment-text-link"><a href="<TMPL_VAR lj_siteroot>/sup/sms_tos.bml"><TMPL_VAR expr="ml('/shop/index.bml.storefront.paymentmethods.sup_text')"></a></span>
+<TMPL_ELSE>
+    <a href="<TMPL_VAR lj_siteroot>/support/faqbrowse.bml?faqid=21#methods" class="paymentmethods-logos">
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/paypal.png?v=7016" alt="PayPal" />
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/webmoney.png?v=7016" alt="WebMoney" /><br />
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/visa.png?v=7016" alt="VISA" />
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/mastercard.png?v=7016" alt="MasterCard" />
+        <img src="<TMPL_VAR lj_imgprefix>/shop/payment/aexpress.png?v=7016" alt="American Expess" />
+    <img src="<TMPL_VAR lj_imgprefix>/shop/payment/dnovus.png?v=7016" alt="Discover Novus" />
+    </a>
+</TMPL_IF>
+
+</div></div></div></div></div></div>

Tags: ailyin, andy, ljcom, pm, 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