[Rt-commit] rt branch, development, updated. 781817eb8cc85b4f18c4369e5edaebc4a41f8329

Thomas Sibley trs at bestpractical.com
Wed Jun 23 18:45:38 EDT 2010


The branch, development has been updated
       via  781817eb8cc85b4f18c4369e5edaebc4a41f8329 (commit)
       via  e840f4da1d87a1c70e1b292ac184e0968e1b496e (commit)
       via  5cb537897f957466d9cca9693ed649a724298015 (commit)
      from  63f40caee208ba39c7f11fdd3def88c2b5f4f68b (commit)

Summary of changes:
 etc/config.yml                |    4 +--
 lib/RT/Action/ConfigSystem.pm |   24 ++++++-----------
 lib/RT/Action/UpdateUser.pm   |    6 +++-
 lib/RT/View/SetupWizard.pm    |   57 +++++++++++++++++++++--------------------
 4 files changed, 44 insertions(+), 47 deletions(-)

- Log -----------------------------------------------------------------
commit 5cb537897f957466d9cca9693ed649a724298015
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Jun 23 15:05:46 2010 -0400

    Remove the default setup wizard steps

diff --git a/etc/config.yml b/etc/config.yml
index e1daabd..37e2a0b 100644
--- a/etc/config.yml
+++ b/etc/config.yml
@@ -49,9 +49,7 @@ framework:
         wait_seconds: 10
         nav_menu: 0
     - SetupWizard:
-        add_steps:
-          - template: basics
-            header: RT Basics
+        nodefault: 1
     - WyzzEditor: {}
   PubSub: 
     Backend: Memcached

commit e840f4da1d87a1c70e1b292ac184e0968e1b496e
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Jun 23 18:45:57 2010 -0400

    Abandon the multipage action
    
    We don't actually need it and it wasn't playing nice with normal
    actions.

diff --git a/lib/RT/Action/ConfigSystem.pm b/lib/RT/Action/ConfigSystem.pm
index 86883c3..5873b92 100644
--- a/lib/RT/Action/ConfigSystem.pm
+++ b/lib/RT/Action/ConfigSystem.pm
@@ -2,10 +2,7 @@ use strict;
 use warnings;
 
 package RT::Action::ConfigSystem;
-
-use Moose;
-extends qw/RT::Action Jifty::Action/;
-with    qw/Jifty::Plugin::Multipage::Action/;
+use base qw/RT::Action Jifty::Action/;
 
 use Scalar::Defer; 
 use Try::Tiny;
diff --git a/lib/RT/View/SetupWizard.pm b/lib/RT/View/SetupWizard.pm
index 8788f05..6e85f1b 100644
--- a/lib/RT/View/SetupWizard.pm
+++ b/lib/RT/View/SetupWizard.pm
@@ -69,13 +69,12 @@ template 'index.html' => setup_page {
         _("Let's get your RT install setup and ready to go.  We'll step you through a few steps to configure the basics.");
     };
 
-    my $config = new_action(
-        class   => 'RT::Action::ConfigSystem',
-        moniker => 'sysconfig'
+    hyperlink(
+        url   => 'database',
+        label => 'Start',
+        as_button => 1
     );
 
-    $config->next_page_button( url => 'database', label => 'Start' );
-
     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>.");
     };
@@ -84,25 +83,14 @@ template 'index.html' => setup_page {
 template 'database' => setup_page {
     h2 { _("Configure your database") };
     
-    my $config = new_action(
-        class   => 'RT::Action::ConfigSystem',
-        moniker => 'sysconfig'
-    );
-
     show 'database_widget';
-
-    $config->prev_page_button( url => 'index.html', label => 'Previous step' );
-    $config->next_page_button( url => 'root', label => 'Next step', submit => undef );
+    # need to reload config here too, before the next page!
+    show 'buttons', prev => 'index.html', next => 'root';
 };
 
 template 'root' => setup_page {
     h2 { _("Change the default root password") };
 
-    my $config = new_action(
-        class   => 'RT::Action::ConfigSystem',
-        moniker => 'sysconfig'
-    );
-
     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.");
     };
@@ -110,21 +98,14 @@ template 'root' => setup_page {
     my $user = RT::Model::User->new;
     $user->load_by_cols(name => 'root');
 
-    my $action = $user->as_update_action;
+    my $action = $user->as_update_action( moniker => 'updateuser-root' );
     render_param( $action => 'password', ajax_validates => 0 );
     render_param(
         $action => 'password_confirm',
         label   => 'Confirm Password',
     );
-
-    $action->button;
-
-    $config->prev_page_button( url => 'database', label => 'Previous step' );
-    $config->next_page_button(
-        url     => 'ui',
-        submit  => $action,
-        label   => 'Next step',
-    );
+    
+    show 'buttons', prev => 'database', next => 'done';
 };
 
 # root password
@@ -152,5 +133,25 @@ template 'basics' => sub {
     }
 };
 
+template 'done' => setup_page {
+    h2 { _("Setup complete!") };
+};
+
+private template 'buttons' => sub {
+    my $self = shift;
+    my %args = @_;
+
+    hyperlink(
+        url => $args{'prev'},
+        label => 'Previous step',
+        as_button => 1,
+    );
+
+    form_submit(
+        url     => $self->fragment_for($args{'next'}),
+        label   => 'Next step',
+    );
+};
+
 1;
 

commit 781817eb8cc85b4f18c4369e5edaebc4a41f8329
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Jun 23 18:46:27 2010 -0400

    Improve action result messages

diff --git a/lib/RT/Action/ConfigSystem.pm b/lib/RT/Action/ConfigSystem.pm
index 5873b92..e146959 100644
--- a/lib/RT/Action/ConfigSystem.pm
+++ b/lib/RT/Action/ConfigSystem.pm
@@ -77,12 +77,20 @@ sub arguments_by_sections {
 sub take_action {
     my $self = shift;
 
+    my @updated;
     for my $arg ( $self->argument_names ) {
         if ( $self->has_argument($arg) ) {
             RT->config->set( $arg, $self->argument_value($arg) );
+            push @updated, $arg;
         }
     }
 
+    if (@updated) {
+        my $list = join ", ", @updated;
+        $list =~ s/, (?!.*,)/, and /;
+        $self->result->message("Set the following system configuration options: $list");
+    }
+
     return 1;
 }
 
@@ -177,16 +185,5 @@ sub validate_disable_graphviz {
     return 1;
 }
 
-=head2 report_success
-
-=cut
-
-sub report_success {
-    my $self = shift;
-
-    # Your success message here
-    $self->result->message(_('Updated system'));
-}
-
 1;
 
diff --git a/lib/RT/Action/UpdateUser.pm b/lib/RT/Action/UpdateUser.pm
index 2b0a89e..393c7e7 100644
--- a/lib/RT/Action/UpdateUser.pm
+++ b/lib/RT/Action/UpdateUser.pm
@@ -34,7 +34,6 @@ sub arguments {
 
 sub take_action {
     my $self = shift;
-    warn "running UpdateUser!";
     $self->SUPER::take_action;
     $self->_update_custom_field_values;
     for my $field (qw/disabled privileged/) {
@@ -52,4 +51,9 @@ sub take_action {
     return 1;
 }
 
+sub report_success {
+    my $self = shift;
+    $self->result->message("Updated user ", $self->record->name);
+}
+
 1;

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


More information about the Rt-commit mailing list