Типа я (zilogic) wrote in changelog,
Типа я
zilogic
changelog

[livejournal] r20396: LJSUP-10203: Create two widgets: "Major ...

Committer: amyshkin
LJSUP-10203: Create two widgets: "Major Notes" and "LiveJournal Feature showcase"
U   trunk/cgi-bin/LJ/Widget/MarqueeFeatures.pm
U   trunk/htdocs/admin/marqueefeatures.bml
U   trunk/templates/MarqueeFeatures/index.tmpl
Modified: trunk/cgi-bin/LJ/Widget/MarqueeFeatures.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/MarqueeFeatures.pm	2011-10-20 12:21:08 UTC (rev 20395)
+++ trunk/cgi-bin/LJ/Widget/MarqueeFeatures.pm	2011-10-20 12:34:05 UTC (rev 20396)
@@ -14,7 +14,27 @@
     my $class = shift;
     my %opts = @_;
 
-    my $marquee_features_json = LJ::ExtBlock->load_by_id('marquee_features');
+    my $params = {
+        'marqueefeatures' => [
+            'widget.marqueefeatures.title',
+            'widget.marqueefeatures.also',
+            'marquee_features',
+        ],
+        'majornotes' => [
+            'widget.majornotes.title',
+            'widget.majornotes.also',
+            'major_notes',
+        ],
+        'featureshowcase' => [
+            'widget.featureshowcase.title',
+            'widget.featureshowcase.also',
+            'feature_showcase',
+        ],
+    };
+
+    my $type = $opts{'type'} || 'marqueefeatures';
+    my ($subject, $see, $block) = @{$params->{$type}};
+    my $marquee_features_json = LJ::ExtBlock->load_by_id($block);
     $marquee_features_json = $marquee_features_json->blocktext if $marquee_features_json;
 
     my $marquee_features = LJ::JSON->from_json($marquee_features_json);
@@ -28,9 +48,11 @@
     );
 
     $template->param (
-        also_text   => $also->{text},
-        also_link   => $also->{link},
-        links       => $marquee_features,
+        also_text => $also->{text},
+        also_link => $also->{link},
+        links     => $marquee_features,
+        subject   => LJ::Lang::ml($subject),
+        see       => LJ::Lang::ml($see),
     );
 
     return $template->output;

Modified: trunk/htdocs/admin/marqueefeatures.bml
===================================================================
--- trunk/htdocs/admin/marqueefeatures.bml	2011-10-20 12:21:08 UTC (rev 20395)
+++ trunk/htdocs/admin/marqueefeatures.bml	2011-10-20 12:34:05 UTC (rev 20396)
@@ -17,7 +17,9 @@
         unless LJ::check_priv($remote, "siteadmin", "marqueefeatures") || $LJ::IS_DEV_SERVER;
 
     my @marquee_features;
-    if (%POST) {    # Add new entry
+
+    # Add new entry
+    if (%POST) {
         for (my $i = 1; $i < 20; $i++) {
             if ($POST{"text$i"} && $POST{"link$i"}) {
                 push @marquee_features,
@@ -35,6 +37,7 @@
 
     ## Read old data
     my $marquee_features_json = LJ::ExtBlock->load_by_id('marquee_features');
+
     if ($marquee_features_json) {
         $marquee_features_json = $marquee_features_json->blocktext;
         @marquee_features = @{LJ::JSON->from_json($marquee_features_json)};
@@ -43,7 +46,7 @@
     ## Page
     my $ret = qq|
         <div class="canyon">
-            <div class="canyon-side"> | . 
+            <div class="canyon-side"> | .
                 LJ::Widget::MarqueeFeatures->render() . qq|
             </div>
             <div class="canyon-section">
@@ -57,6 +60,7 @@
 
     my $i = 6;
     push @marquee_features, { text => '', link => '' } while --$i;
+
     foreach my $line (@marquee_features) {
         my $prefix = $i ? '&gt;&gt;' : 'Also check out ';
 

Modified: trunk/templates/MarqueeFeatures/index.tmpl
===================================================================
--- trunk/templates/MarqueeFeatures/index.tmpl	2011-10-20 12:21:08 UTC (rev 20395)
+++ trunk/templates/MarqueeFeatures/index.tmpl	2011-10-20 12:34:05 UTC (rev 20396)
@@ -1,10 +1,10 @@
-<div class="w-head"><h2><span class="w-head-in"><TMPL_VAR expr="ml('widget.marqueefeatures.title')"></span></h2><i class="w-head-corner"></i></div>
+<div class="w-head"><h2><span class="w-head-in"><TMPL_VAR subject></span></h2><i class="w-head-corner"></i></div>
 <div class="w-body">
     <ul class="w-list">
         <TMPL_LOOP links>
             <li><a href="<TMPL_VAR link>"><TMPL_VAR text></a></li>
         </TMPL_LOOP>
     </ul>
-    <p><TMPL_VAR expr="ml('widget.marqueefeatures.also')"> <a href="<TMPL_VAR also_link>"><TMPL_VAR also_text></a></p>
+    <p><TMPL_VAR see> <a href="<TMPL_VAR also_link>"><TMPL_VAR also_text></a></p>
 </div>
 

Tags: amyshkin, bml, livejournal, pm, tmpl, zilogic
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