[dw-free] Select Style: Page Setup doesn't update itself when you switch styles
[commit: http://hg.dwscoalition.org/dw-free/rev/8a2227edfe0b]
http://bugs.dwscoalition.org/show_bug.cgi?id=3621
Update layout chooser (number of sidebars, see bottom of page in /customize)
after choosing a new theme.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3621
Update layout chooser (number of sidebars, see bottom of page in /customize)
after choosing a new theme.
Patch by
Files modified:
- cgi-bin/LJ/Widget/LayoutChooser.pm
- cgi-bin/LJ/Widget/ThemeChooser.pm
--------------------------------------------------------------------------------
diff -r 57857f57e558 -r 8a2227edfe0b cgi-bin/LJ/Widget/LayoutChooser.pm
--- a/cgi-bin/LJ/Widget/LayoutChooser.pm Mon May 16 17:32:32 2011 +0800
+++ b/cgi-bin/LJ/Widget/LayoutChooser.pm Mon May 16 18:06:35 2011 +0800
@@ -138,6 +138,11 @@
apply_forms.forEach(function (form) {
DOM.addEventListener(form, "submit", function (evt) { self.applyLayout(evt, form) });
});
+
+ if ( ! self._init ) {
+ LiveJournal.register_hook( "update_other_widgets", function( updated ) { self.refreshLayoutChoices.apply( self, [ updated ] ) } )
+ self._init = true;
+ }
},
applyLayout: function (evt, form) {
var given_layout_choice = form["Widget[LayoutChooser]_layout_choice"].value + "";
@@ -157,6 +162,11 @@
},
onRefresh: function (data) {
this.initWidget();
+ },
+ refreshLayoutChoices: function( updatedWidget ) {
+ if ( updatedWidget == "ThemeChooser" ) {
+ this.updateContent();
+ }
}
];
}
diff -r 57857f57e558 -r 8a2227edfe0b cgi-bin/LJ/Widget/ThemeChooser.pm
--- a/cgi-bin/LJ/Widget/ThemeChooser.pm Mon May 16 17:32:32 2011 +0800
+++ b/cgi-bin/LJ/Widget/ThemeChooser.pm Mon May 16 18:06:35 2011 +0800
@@ -427,6 +427,7 @@
theme_chooser_id: $('theme_chooser_id').value
});
alert(Customize.ThemeChooser.confirmation);
+ LiveJournal.run_hook("update_other_widgets", "ThemeChooser");
},
previewTheme: function (evt, href) {
window.open(href, 'theme_preview', 'resizable=yes,status=yes,toolbar=no,location=no,menubar=no,scrollbars=yes');
--------------------------------------------------------------------------------
