[Jifty-commit] r7134 - jifty/trunk/lib/Jifty/Plugin/SetupWizard

Jifty commits jifty-commit at lists.jifty.org
Mon Jun 1 17:50:48 EDT 2009


Author: sartak
Date: Mon Jun  1 17:50:48 2009
New Revision: 7134

Modified:
   jifty/trunk/lib/Jifty/Plugin/SetupWizard/View.pm

Log:
First stab at an extensible setup wizard

Modified: jifty/trunk/lib/Jifty/Plugin/SetupWizard/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/SetupWizard/View.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/SetupWizard/View.pm	Mon Jun  1 17:50:48 2009
@@ -3,8 +3,63 @@
 use warnings;
 use Jifty::View::Declare -base;
 
-template '/__jifty/admin/setupwizard/entry' => page {
-    h1 { "Welcome to " . Jifty->config->framework('ApplicationName') . "!" };
+my @steps = (
+    'language',
+    'database',
+);
+
+template '/__jifty/admin/setupwizard' => page {
+    my $appname = Jifty->config->framework('ApplicationName');
+    h1 { "Welcome to $appname!" };
+
+    render_region(
+        name      => 'WizardStep',
+        path      => "/__jifty/admin/setupwizard/step",
+        arguments => {
+            step => 0,
+        },
+    );
+
+    p { _("You're seeing this configuration because you started $appname in AdminMode and the SetupWizard plugin. Disable one or both of these to restore normal operation.") };
+};
+
+template '/__jifty/admin/setupwizard/step' => sub {
+    my $step = get('step');
+    my $name = $steps[$step] or abort(400);
+
+    show "/__jifty/admin/setupwizard/$name";
+
+    if ($step > 0) {
+        hyperlink(
+            label => _("Back: %1", $steps[$step - 1]),
+            onclick => {
+                replace_self => 1,
+                arguments => {
+                    step => $step - 1,
+                },
+            },
+        );
+    }
+
+    if ($step < @steps - 1) {
+        hyperlink(
+            label => _("Skip: %1", $steps[$step + 1]),
+            onclick => {
+                replace_self => 1,
+                arguments => {
+                    step => $step + 1,
+                },
+            },
+        );
+    }
+};
+
+template '/__jifty/admin/setupwizard/language' => sub {
+    p { _("You may select a different language.") };
+};
+
+template '/__jifty/admin/setupwizard/database' => sub {
+    p { _("You may choose a database engine.") };
 };
 
 1;


More information about the Jifty-commit mailing list