[Rt-commit] rt branch, development, updated. 328f489080cefa18d38af8f5feabeb7a9c7b3964

Thomas Sibley trs at bestpractical.com
Tue Jul 20 11:14:46 EDT 2010


The branch, development has been updated
       via  328f489080cefa18d38af8f5feabeb7a9c7b3964 (commit)
      from  68e51ec61910366ea39d9b2b7045e3058b4272bb (commit)

Summary of changes:
 lib/RT/Dispatcher.pm                 |    7 +--
 lib/RT/View/SetupWizard.pm           |   80 ++++++++++++++++++++++++++--------
 share/web/static/css/setupwizard.css |   68 ++++++++++++++++++++++++++++-
 3 files changed, 131 insertions(+), 24 deletions(-)

- Log -----------------------------------------------------------------
commit 328f489080cefa18d38af8f5feabeb7a9c7b3964
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jul 20 11:16:08 2010 -0400

    Show a step list so the user knows what they're getting into

diff --git a/lib/RT/Dispatcher.pm b/lib/RT/Dispatcher.pm
index 84922e7..3029081 100644
--- a/lib/RT/Dispatcher.pm
+++ b/lib/RT/Dispatcher.pm
@@ -173,10 +173,9 @@ on qr{^/$} => run {
     show '/index.html';
 };
 
-# Canonicalize /setup to /setup/ so we can properly use relative links
-# XXX: This is a bit ugly
-before qr'^/setup$' => run {
-    redirect '/setup/';
+# Redirect /setup and /setup/ to /setup/start
+before qr'^/setup/?$' => run {
+    redirect '/setup/start';
 };
 
 on qr{^/Dashboards/(\d+)} => run {
diff --git a/lib/RT/View/SetupWizard.pm b/lib/RT/View/SetupWizard.pm
index c25dba6..9d6af24 100644
--- a/lib/RT/View/SetupWizard.pm
+++ b/lib/RT/View/SetupWizard.pm
@@ -59,41 +59,47 @@ sub setup_page (&) {
         h1 { _("RT Setup Wizard") };
         div {{ id is 'setupwizard' };
             form {
-                $code->($self);
+                div {{ class is 'column left widest' };
+                    $code->($self);
+                }
+                div {{ class is 'column right thinnest' };
+                    show 'steps';
+                }
             };
+            hr {{ class is 'clear' }};
         };
         show '_config_javascript';
     };
 }
 
 sub steps {
-    return qw(
-        index.html
-        database
-        root
-        organization
-        email
-        web
-        done
+    return (
+        [ start         => _('Start') ],
+        [ database      => _('Configure your database') ],
+        [ root          => _('Change the default root password') ],
+        [ organization  => _('Tell RT about your organization') ],
+        [ email         => _('Configure email') ],
+        [ web           => _('Configure the web interface') ],
+        [ done          => _('Finish setup') ],
     );
 }
 
-template 'index.html' => setup_page {
+template 'start' => setup_page {
     h2 { _("Welcome to RT!") };
 
     p {
-        _("Let's get your RT install setup and ready to go.  We'll step you through a few steps to configure the basics.");
+        _("Let's get your new RT setup and ready to go.  We'll go through a few steps to configure the basics.");
     };
-
-    show 'buttons', for => 'index.html';
-
+    
     p {
         outs_raw _("This setup wizard was activated by the presence of <tt>SetupMode: 1</tt> in one of your configuration files. If you are seeing this erroneously, you may restore normal operation by adjusting the <tt>etc/site_config.yml</tt> file to have <tt>SetupMode: 0</tt> set under <tt>framework</tt>.");
     };
+
+    show 'buttons', for => 'index.html';
 };
 
 template 'database' => setup_page {
-    h2 { _("Configure your database") };
+    show title => 'database';
     
     p {{ class is 'warning' };
         _("RT may ask you, after saving the database settings, to login again as root with the default password.");
@@ -105,7 +111,7 @@ template 'database' => setup_page {
 };
 
 template 'root' => setup_page {
-    h2 { _("Change the default root password") };
+    show title => 'root';
 
     p {
         _("It is very important that you change the password of RT's root user.  Leaving it as the default of 'password' is a serious security risk.");
@@ -125,7 +131,7 @@ template 'root' => setup_page {
 };
 
 template 'organization' => setup_page {
-    h2 { _("Tell RT about your organization") };
+    show title => 'organization';
 
     p { _("Now tell RT just the very basics about your organization.") };
 
@@ -134,7 +140,7 @@ template 'organization' => setup_page {
 };
 
 template 'email' => setup_page {
-    h2 { _("Configure the email setup") };
+    show title => 'email';
 
     p { _("One of the main ways to interact with RT is via email.  Setup the basics now.") };
 
@@ -145,7 +151,7 @@ template 'email' => setup_page {
 };
 
 template 'web' => setup_page {
-    h2 { _("Configure the web setup") };
+    show title => 'web';
 
     p { _("RT needs to know a little bit about how you have it setup on your webserver.") };
 
@@ -184,6 +190,42 @@ EOT
     form_submit( label => 'Turn off Setup Mode and go to RT' );
 };
 
+private template 'title' => sub {
+    my ($self, $step) = @_;
+    h2 { $self->step_title($step) };
+};
+
+private template 'steps' => sub {
+    my $self = shift;
+    my $current = $self->intuit_current_step(@_);
+
+    h2 { _("Steps to Configure RT") };
+
+    ol {{ class is 'steps' };
+        for my $step ( $self->steps ) {
+            li {{ $current eq $step->[0] ? ( class is 'current' ) : () };
+                hyperlink(
+                    url     => $step->[0],
+                    label   => $step->[1],
+                );
+            };
+        }
+    };
+};
+
+sub intuit_current_step {
+    my $self = shift;
+    my %args = @_;
+
+    if ( defined $args{'for'} and length $args{'for'} ) {
+        return $args{'for'};
+    }
+
+    my $template = lc((split '/', Jifty->web->request->path)[-1]);
+
+    return $self->step_for($template)->[0] ? $template : undef;
+}
+
 private template 'rt_config_fields' => sub {
     my $self = shift;
 
diff --git a/share/web/static/css/setupwizard.css b/share/web/static/css/setupwizard.css
index e736eaf..3d6d435 100644
--- a/share/web/static/css/setupwizard.css
+++ b/share/web/static/css/setupwizard.css
@@ -1,3 +1,65 @@
+/* Layout */
+
+#setupwizard .column {
+    width: 49%;
+    margin: 0;
+    padding: 0;
+}
+
+#setupwizard .column > h1:first-child,
+#setupwizard .column > h2:first-child,
+#setupwizard .column > h3:first-child,
+#setupwizard .column > p:first-child
+{
+    margin-top: 0;
+    padding-top: 0;
+}
+
+#setupwizard .right {
+    float: right;
+    clear: right;
+}
+
+#setupwizard .left {
+    float: left;
+    clear: left;
+}
+
+#setupwizard .widest { width: 73%; }
+#setupwizard .thinnest { width: 25%; }
+
+#setupwizard hr.clear {
+    display: block;
+    clear: both;
+    visibility: hidden;
+    height: 1px !important;
+    padding: 0;
+    margin: 0;
+    border: none;
+}
+
+/* Step list */
+
+#setupwizard .steps {
+    font-size: 1.2em;
+}
+
+#setupwizard .steps li {
+    line-height: 1em;
+    padding-bottom: 0.75em;
+}
+
+#setupwizard .steps li a {
+    color: black;
+}
+
+#setupwizard .steps li.current, #setupwizard .steps li.current a {
+    color: #06c;
+    font-weight: bold;
+}
+
+/* RT specific config fields with doc */
+
 #setupwizard .config-field .form_field .label {
     width: 12em;
     font-weight: bold;
@@ -16,13 +78,16 @@
     margin-top: 0;
 }
 
+
+/* Buttons! */
+
 #setupwizard .test-db-connectivity {
     margin-left: 16%;
 }
 
 #setupwizard .button-line {
     position: relative;
-    width: 45em;
+    width: 100%;
     height: 2.5em;
     margin-top: 2em;
     padding-top: 0.5em;
@@ -44,3 +109,4 @@
     margin: 0;
     padding: 0;
 }
+

-----------------------------------------------------------------------


More information about the Rt-commit mailing list