fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-08-13 01:19 am

[dw-free] Customize: make 'Choose a Page Setup' available in Customize Style

[commit: http://hg.dwscoalition.org/dw-free/rev/7a3697baf64c]

http://bugs.dwscoalition.org/show_bug.cgi?id=2846

Add the ability to choose number of columns under
http://www.dreamwidth.org/customize/options instead of just in
http://www.dreamwidth.org/customize

Patch by [personal profile] ninetydegrees.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/LJ/Widget/CurrentTheme.pm
  • cgi-bin/LJ/Widget/LayoutChooser.pm
  • htdocs/customize/options.bml
  • htdocs/stc/customize.css
--------------------------------------------------------------------------------
diff -r b11d3ffd6642 -r 7a3697baf64c bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Fri Aug 13 09:10:51 2010 +0800
+++ b/bin/upgrading/en.dat	Fri Aug 13 09:19:29 2010 +0800
@@ -4572,6 +4572,8 @@ widget.layoutchooser.layout.apply=Apply 
 
 widget.layoutchooser.title=3. Choose a Page Setup
 
+widget.layoutchooser.title_nonum=Choose a Page Setup
+
 widget.linkslist.about=Use the form below to create a list of links that will appear on your journal.
 
 widget.linkslist.about.blank=Enter a "-" for the title to create a blank line (not in all themes).
diff -r b11d3ffd6642 -r 7a3697baf64c cgi-bin/LJ/Widget/CurrentTheme.pm
--- a/cgi-bin/LJ/Widget/CurrentTheme.pm	Fri Aug 13 09:10:51 2010 +0800
+++ b/cgi-bin/LJ/Widget/CurrentTheme.pm	Fri Aug 13 09:19:29 2010 +0800
@@ -80,10 +80,12 @@ sub render_body {
             $ret .= "<li><a href='$LJ::SITEROOT/customize/advanced/layeredit?id=" . $theme->themeid . "'>" . $class->ml('widget.currenttheme.options.editthemelayer') . "</a></li>";
         }
     }
-
-    unless ($no_theme_chooser) {
+    if ($no_theme_chooser) {
+        $ret .= "<li><a href='$LJ::SITEROOT/customize/options$getextra#layout'>" . $class->ml('widget.currenttheme.options.layout') . "</a></li>";
+    } else {
         $ret .= "<li><a href='$LJ::SITEROOT/customize/$getextra#layout'>" . $class->ml('widget.currenttheme.options.layout') . "</a></li>";
     }
+
     $ret .= "</ul>";
     $ret .= "</div><!-- end .theme-current-links -->";
     $ret .= "</div><!-- end .theme-current-content -->";
diff -r b11d3ffd6642 -r 7a3697baf64c cgi-bin/LJ/Widget/LayoutChooser.pm
--- a/cgi-bin/LJ/Widget/LayoutChooser.pm	Fri Aug 13 09:10:51 2010 +0800
+++ b/cgi-bin/LJ/Widget/LayoutChooser.pm	Fri Aug 13 09:19:29 2010 +0800
@@ -29,11 +29,15 @@ sub render_body {
     my $u = $class->get_effective_remote();
     die "Invalid user." unless LJ::isu($u);
 
+    my $no_theme_chooser = defined $opts{no_theme_chooser} ? $opts{no_theme_chooser} : 0;
+
     my $ad_layout_id = defined $opts{ad_layout_id} ? $opts{ad_layout_id} : 0;
     my $headextra = $opts{headextra};
 
     my $ret;
-    $ret .= "<h2 class='widget-header'>" . $class->ml('widget.layoutchooser.title') . "</h2>";
+    $ret .= "<h2 class='widget-header'>";
+    $ret .= $no_theme_chooser ? $class->ml('widget.layoutchooser.title_nonum') : $class->ml('widget.layoutchooser.title');
+    $ret .= "</h2>";
     $ret .= "<div class='layout-content'>";
 
     if (eval "use LJ::Widget::AdLayout; 1;" && LJ::Widget::AdLayout->should_render_for_u($u)) {
diff -r b11d3ffd6642 -r 7a3697baf64c htdocs/customize/options.bml
--- a/htdocs/customize/options.bml	Fri Aug 13 09:10:51 2010 +0800
+++ b/htdocs/customize/options.bml	Fri Aug 13 09:19:29 2010 +0800
@@ -49,7 +49,7 @@ body<=
     my $ret;
 
     if (LJ::did_post()) {
-        my @errors = LJ::Widget->handle_post(\%POST, qw(CustomizeTheme JournalTitles MoodThemeChooser NavStripChooser S2PropGroup LinksList));
+        my @errors = LJ::Widget->handle_post(\%POST, qw(CustomizeTheme JournalTitles MoodThemeChooser NavStripChooser S2PropGroup LinksList LayoutChooser));
         $ret .= LJ::bad_input(@errors) if @errors;
     }
 
@@ -85,6 +85,16 @@ body<=
     );
     $ret .= "</div><!-- end .customize-wrapper -->";
 
+    my $layout_chooser = LJ::Widget::LayoutChooser->new;
+    $headextra .= $layout_chooser->wrapped_js( page_js_obj => "Customize" );
+    $ret .= "<a name='layout'></a>";
+    $ret .= "<div class='layout-selector-wrapper pkg'>";
+    $ret .= $layout_chooser->render(
+        headextra => \$headextra,
+        no_theme_chooser => 1,
+    );
+    $ret .= "</div><!-- end .layout-selector-wrapper' -->";
+
     $ret .= "<h2 class='widget-header'><?_ml .advanced _ml?></h2>";
     $ret .= "<a href='advanced/'><?_ml .advanced _ml?></a>";
 
diff -r b11d3ffd6642 -r 7a3697baf64c htdocs/stc/customize.css
--- a/htdocs/stc/customize.css	Fri Aug 13 09:10:51 2010 +0800
+++ b/htdocs/stc/customize.css	Fri Aug 13 09:19:29 2010 +0800
@@ -22,6 +22,10 @@ h2.widget-header {
 
 .theme-selector-wrapper {
     clear: both;
+}
+
+.layout-selector-wrapper {
+    margin-bottom: 15px;
 }
 
 .theme-customize {
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org